diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-10-31 08:19:01 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-10-31 08:19:01 +0000 |
commit | 5eb2e5586a91fc08cb9a8ddbd39416deccad08d8 (patch) | |
tree | e0f348d03490e9609d84f78854c8ba8d070bd03c | |
parent | d3be49ac9e5a338f15056b7c5b14aa905bb1f474 (diff) | |
download | fetchmail-5eb2e5586a91fc08cb9a8ddbd39416deccad08d8.tar.gz fetchmail-5eb2e5586a91fc08cb9a8ddbd39416deccad08d8.tar.bz2 fetchmail-5eb2e5586a91fc08cb9a8ddbd39416deccad08d8.zip |
STEP 8: All socket writes now go through SockWrite.
svn path=/trunk/; revision=451
-rw-r--r-- | driver.c | 10 | ||||
-rw-r--r-- | socket.c | 40 |
2 files changed, 12 insertions, 38 deletions
@@ -705,7 +705,7 @@ struct query *ctl; /* query control record */ if (ctl->mda[0]) n = write(mboxfd,headers,oldlen); else - n = SockPuts(headers, sinkfp); + n = SockWrite(headers, oldlen, sinkfp); if (n < 0) { @@ -722,7 +722,7 @@ struct query *ctl; /* query control record */ /* SMTP byte-stuffing */ if (*bufp == '.' && ctl->mda[0] == 0) - SockPuts(".", sinkfp); + SockWrite(".", 1, sinkfp); /* replace all LFs with CR-LF in the line */ if (!ctl->mda[0]) @@ -739,7 +739,7 @@ struct query *ctl; /* query control record */ if (ctl->mda[0]) n = write(mboxfd,bufp,strlen(bufp)); else - n = SockPuts(bufp, sinkfp); + n = SockWrite(bufp, strlen(bufp), sinkfp); if (!ctl->mda[0]) free(bufp); @@ -1087,7 +1087,7 @@ va_dcl { va_end(ap); strcat(buf, "\r\n"); - SockPuts(buf, sockfp); + SockWrite(buf, strlen(buf), sockfp); if (outlevel == O_VERBOSE) { @@ -1129,7 +1129,7 @@ va_dcl { va_end(ap); strcat(buf, "\r\n"); - SockPuts(buf, sockfp); + SockWrite(buf, strlen(buf), sockfp); if (outlevel == O_VERBOSE) { char *cp; @@ -74,30 +74,23 @@ int clientPort; return fdopen(sock, "r+"); } -int SockPuts(buf, sockfp) -char *buf; -FILE *sockfp; -{ - return(SockWrite(fileno(sockfp), buf, strlen(buf))); -} - -int SockWrite(socket,buf,len) -int socket; +int SockWrite(buf,len,sockfp) char *buf; int len; +FILE *sockfp; { - int n, rdlen = 0; + int n, wrlen = 0; while (len) { - n = write(socket, buf, len); + n = write(fileno(sockfp), buf, len); if (n <= 0) return -1; len -= n; - rdlen += n; + wrlen += n; buf += n; } - return rdlen; + return wrlen; } static int sbuflen = 0; @@ -147,25 +140,6 @@ int len; return(len); } -int SockRead(socket,buf,len) -int socket; -char *buf; -int len; -{ - int n; - - - while (len) - { - n = SockInternalRead(socket, buf, len); - if (n <= 0) - return -1; - len -= n; - buf += n; - } - return 0; -} - int SockGets(buf, len, sockfp) char *buf; int len; @@ -208,7 +182,7 @@ va_dcl { #endif vsprintf(buf, format, ap); va_end(ap); - return SockWrite(fileno(sockfp), buf, strlen(buf)); + return SockWrite(buf, strlen(buf), sockfp); } |