From 45cc66a611304748f4f2e2d38d8eb00527c93d3e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 4 Nov 1996 17:00:46 +0000 Subject: Eliminated socket.h. svn path=/trunk/; revision=480 --- driver.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 58a0dfa8..0c20746b 100644 --- a/driver.c +++ b/driver.c @@ -36,7 +36,6 @@ #include /* must be included before "socket.h".*/ #include #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); -- cgit v1.2.3