diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-12-17 20:53:10 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-12-17 20:53:10 +0000 |
commit | b85d71b67a2743272f46c85bf479b1051171193d (patch) | |
tree | f828606268e283fa4d36ec6fb91ffc5fb19d9402 /driver.c | |
parent | f034d4af6612be9fc2b393855ec5ac95d548d5d8 (diff) | |
download | fetchmail-b85d71b67a2743272f46c85bf479b1051171193d.tar.gz fetchmail-b85d71b67a2743272f46c85bf479b1051171193d.tar.bz2 fetchmail-b85d71b67a2743272f46c85bf479b1051171193d.zip |
SockGets is gone.
svn path=/trunk/; revision=650
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -276,7 +276,7 @@ static FILE *smtp_open(struct query *ctl) /* if no socket to this host is already set up, try to open one */ if (ctl->smtp_sockfp == (FILE *)NULL) { - if ((ctl->smtp_sockfp = Socket(ctl->smtphost, SMTP_PORT)) == (FILE *)NULL) + if ((ctl->smtp_sockfp = sockopen(ctl->smtphost, SMTP_PORT)) == (FILE *)NULL) return((FILE *)NULL); else if (SMTP_ok(ctl->smtp_sockfp) != SM_OK || SMTP_helo(ctl->smtp_sockfp, ctl->servernames->id) != SM_OK) @@ -289,6 +289,26 @@ static FILE *smtp_open(struct query *ctl) return(ctl->smtp_sockfp); } +static int SockGets(char *buf, int len, FILE *sockfp) +/* get a LF-terminated line, removing \r characters */ +{ + int rdlen = 0; + + while (--len) + { + if ((*buf = fgetc(sockfp)) == EOF) + return -1; + else + rdlen++; + if (*buf == '\n') + break; + if (*buf != '\r') /* remove all CRs */ + buf++; + } + *buf = 0; + return rdlen; +} + 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 */ @@ -861,7 +881,7 @@ const struct method *proto; /* protocol method table */ FILE *sockfp; /* open a socket to the mail server */ - if ((sockfp = Socket(ctl->servernames->id, + if ((sockfp = sockopen(ctl->servernames->id, ctl->port ? ctl->port : protocol->port)) == NULL) { error(0, errno, "connecting to host"); |