aboutsummaryrefslogtreecommitdiffstats
path: root/imap.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-11-06 04:03:49 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-11-06 04:03:49 +0000
commit238cf89924fe33f03ceea5e4997d2ba0776530d3 (patch)
tree7b31a64cb01e8c22fcbc5d02c4a60779f7bdc31a /imap.c
parentf7af7a861c301ac43600e2da965692233e877d4d (diff)
downloadfetchmail-238cf89924fe33f03ceea5e4997d2ba0776530d3.tar.gz
fetchmail-238cf89924fe33f03ceea5e4997d2ba0776530d3.tar.bz2
fetchmail-238cf89924fe33f03ceea5e4997d2ba0776530d3.zip
Back out the attempt to use stdio.
svn path=/trunk/; revision=488
Diffstat (limited to 'imap.c')
-rw-r--r--imap.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/imap.c b/imap.c
index 0e75524d..b0e39936 100644
--- a/imap.c
+++ b/imap.c
@@ -13,6 +13,7 @@
#if defined(STDC_HEADERS)
#include <stdlib.h>
#endif
+#include "socket.h"
#include "fetchmail.h"
static int count, seen, recent, unseen;
@@ -26,11 +27,11 @@ FILE *sockfp;
seen = 0;
do {
- if (fgets(buf, sizeof(buf), sockfp) == (char *)NULL)
+ if (SockGets(buf, sizeof(buf), sockfp) < 0)
return(PS_SOCKET);
if (outlevel == O_VERBOSE)
- fprintf(stderr,"%s",buf);
+ fprintf(stderr,"%s\n",buf);
/* interpret untagged status responses */
if (strstr(buf, "EXISTS"))
@@ -120,7 +121,7 @@ int *sizes;
char buf [POPBUFSIZE+1];
gen_send(sockfp, "FETCH 1:%d RFC822.SIZE", count);
- while (fgets(buf, sizeof(buf), sockfp) != (char *)NULL)
+ while (SockGets(buf, sizeof(buf), sockfp) >= 0)
{
int num, size;
@@ -133,7 +134,6 @@ int *sizes;
else
sizes[num - 1] = -1;
}
- fseek(sockfp, 0L, SEEK_CUR);
return(0);
}
@@ -165,11 +165,10 @@ int *lenp;
/* looking for FETCH response */
do {
- if (fgets(buf, sizeof(buf), sockfp) == (char *)NULL)
+ if (SockGets(buf, sizeof(buf), sockfp) < 0)
return(PS_SOCKET);
} while
(sscanf(buf+2, "%d FETCH (RFC822 {%d}", &num, lenp) != 2);
- fseek(sockfp, 0L, SEEK_CUR);
if (num != number)
return(PS_ERROR);
@@ -185,13 +184,10 @@ int number;
{
char buf [POPBUFSIZE+1];
- if (fgets(buf, sizeof(buf), sockfp) == (char *)NULL)
+ if (SockGets(buf, sizeof(buf), sockfp) < 0)
return(PS_SOCKET);
else
- {
- fseek(sockfp, 0L, SEEK_CUR);
return(0);
- }
}
static int imap_delete(sockfp, ctl, number)