aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-12-17 20:53:10 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-12-17 20:53:10 +0000
commitb85d71b67a2743272f46c85bf479b1051171193d (patch)
treef828606268e283fa4d36ec6fb91ffc5fb19d9402 /driver.c
parentf034d4af6612be9fc2b393855ec5ac95d548d5d8 (diff)
downloadfetchmail-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.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/driver.c b/driver.c
index 5d8abfb7..6ef734bf 100644
--- a/driver.c
+++ b/driver.c
@@ -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");