diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-11-04 17:00:46 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-11-04 17:00:46 +0000 |
commit | 45cc66a611304748f4f2e2d38d8eb00527c93d3e (patch) | |
tree | 456b9c0bf641077756418d31269a88609911ce49 /driver.c | |
parent | 3153b1bcc67a1d910a200170a3e669a377da95ee (diff) | |
download | fetchmail-45cc66a611304748f4f2e2d38d8eb00527c93d3e.tar.gz fetchmail-45cc66a611304748f4f2e2d38d8eb00527c93d3e.tar.bz2 fetchmail-45cc66a611304748f4f2e2d38d8eb00527c93d3e.zip |
Eliminated socket.h.
svn path=/trunk/; revision=480
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -36,7 +36,6 @@ #include <netinet/in.h> /* must be included before "socket.h".*/ #include <netdb.h> #endif /* KERBEROS_V4 */ -#include "socket.h" #include "fetchmail.h" #include "smtp.h" @@ -486,6 +485,27 @@ struct query *ctl; return(ctl->smtp_sockfp); } +static int strip_gets(buf, len, sockfp) +/* get a line of input, stripping out \r and \n */ +char *buf; +int len; +FILE *sockfp; +{ + if (fgets(buf, len, sockfp) == (char *)NULL) + return(-1); + else + { + char *sp, *tp; + + for (tp = sp = buf; *sp; sp++) + if (*sp != '\r' && *sp != '\n') + *tp++ = *sp; + *tp++ = '\0'; + + return(strlen(buf)); + } +} + static int gen_readmsg (sockfp, len, delimited, ctl) /* read message content and ship to SMTP or MDA */ FILE *sockfp; /* to which the server is connected */ @@ -507,7 +527,7 @@ struct query *ctl; /* query control record */ oldlen = 0; while (delimited || len > 0) { - if ((n = SockGets(buf,sizeof(buf),sockfp)) < 0) + if ((n = strip_gets(buf,sizeof(buf),sockfp)) < 0) return(PS_SOCKET); vtalarm(ctl->timeout); |