From 3153b1bcc67a1d910a200170a3e669a377da95ee Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 4 Nov 1996 16:22:43 +0000 Subject: Special socket I/O almost gone! svn path=/trunk/; revision=479 --- imap.c | 10 +++++----- pop2.c | 4 ++-- pop3.c | 8 ++++---- smtp.c | 13 ++++++++++--- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/imap.c b/imap.c index b0e39936..bb2e01bd 100644 --- a/imap.c +++ b/imap.c @@ -27,11 +27,11 @@ FILE *sockfp; seen = 0; do { - if (SockGets(buf, sizeof(buf), sockfp) < 0) + if (fgets(buf, sizeof(buf), sockfp) == (char *)NULL) return(PS_SOCKET); if (outlevel == O_VERBOSE) - fprintf(stderr,"%s\n",buf); + fprintf(stderr,"%s",buf); /* interpret untagged status responses */ if (strstr(buf, "EXISTS")) @@ -121,7 +121,7 @@ int *sizes; char buf [POPBUFSIZE+1]; gen_send(sockfp, "FETCH 1:%d RFC822.SIZE", count); - while (SockGets(buf, sizeof(buf), sockfp) >= 0) + while (fgets(buf, sizeof(buf), sockfp) != (char *)NULL) { int num, size; @@ -165,7 +165,7 @@ int *lenp; /* looking for FETCH response */ do { - if (SockGets(buf, sizeof(buf), sockfp) < 0) + if (fgets(buf, sizeof(buf), sockfp) == (char *)NULL) return(PS_SOCKET); } while (sscanf(buf+2, "%d FETCH (RFC822 {%d}", &num, lenp) != 2); @@ -184,7 +184,7 @@ int number; { char buf [POPBUFSIZE+1]; - if (SockGets(buf, sizeof(buf), sockfp) < 0) + if (fgets(buf, sizeof(buf), sockfp) == (char *)NULL) return(PS_SOCKET); else return(0); diff --git a/pop2.c b/pop2.c index a501c624..075ef22e 100644 --- a/pop2.c +++ b/pop2.c @@ -25,9 +25,9 @@ char *argbuf; char buf [POPBUFSIZE+1]; pound_arg = equal_arg = -1; - if (SockGets(buf, sizeof(buf), sockfp) >= 0) { + if (fgets(buf, sizeof(buf), sockfp) != (char *)NULL) { if (outlevel == O_VERBOSE) - fprintf(stderr,"%s\n",buf); + fprintf(stderr,"%s",buf); if (buf[0] == '+') ok = 0; diff --git a/pop3.c b/pop3.c index 4df8473a..4f8f35f7 100644 --- a/pop3.c +++ b/pop3.c @@ -31,9 +31,9 @@ char *argbuf; char buf [POPBUFSIZE+1]; char *bufp; - if (SockGets(buf, sizeof(buf), sockfp) >= 0) { + if (fgets(buf, sizeof(buf), sockfp) != (char *)NULL) { if (outlevel == O_VERBOSE) - fprintf(stderr,"%s\n",buf); + fprintf(stderr,"%s",buf); bufp = buf; if (*bufp == '+' || *bufp == '-') @@ -171,7 +171,7 @@ int *countp, *newp; int num; *newp = 0; - while (SockGets(buf, sizeof(buf), sockfp) >= 0) + while (fgets(buf, sizeof(buf), sockfp) != (char *)NULL) { if (outlevel == O_VERBOSE) fprintf(stderr,"%s\n",buf); @@ -205,7 +205,7 @@ int *sizes; { char buf [POPBUFSIZE+1]; - while (SockGets(buf, sizeof(buf), sockfp) >= 0) + while (fgets(buf, sizeof(buf), sockfp) != (char *)NULL) { int num, size; diff --git a/smtp.c b/smtp.c index 558c32b5..66d47f81 100644 --- a/smtp.c +++ b/smtp.c @@ -103,10 +103,17 @@ static int SMTP_check(FILE *sockfp,char *argbuf) int ok; char buf[SMTPBUFSIZE]; - if ((ok = SockGets(buf, sizeof(buf)-1, sockfp)) > 0) { - buf[ok] = '\0'; + if (fgets(buf, sizeof(buf)-1, sockfp) != (char *)NULL) { if (outlevel == O_VERBOSE) - fprintf(stderr, "SMTP< %s\n", buf); + { + char *sp, *tp; + + for (tp = sp = buf; *sp; sp++) + if (*sp != '\r') + *tp++ = *sp; + *tp++ = '\0'; + fprintf(stderr, "SMTP< %s", buf); + } if (argbuf) strcpy(argbuf,buf); if (buf[0] == '1' || buf[0] == '2' || buf[0] == '3') -- cgit v1.2.3