From 5eb2e5586a91fc08cb9a8ddbd39416deccad08d8 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 31 Oct 1996 08:19:01 +0000 Subject: STEP 8: All socket writes now go through SockWrite. svn path=/trunk/; revision=451 --- socket.c | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) (limited to 'socket.c') diff --git a/socket.c b/socket.c index 6ee4d961..d4dde009 100644 --- a/socket.c +++ b/socket.c @@ -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); } -- cgit v1.2.3