aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--driver.c24
-rw-r--r--fetchmail.h2
-rw-r--r--imap.c1
-rw-r--r--pop2.c1
-rw-r--r--pop3.c1
-rw-r--r--smtp.c1
-rw-r--r--socket.c30
8 files changed, 31 insertions, 31 deletions
diff --git a/Makefile.in b/Makefile.in
index a1524a0a..96c4013e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -204,7 +204,7 @@ $(srcdir)/rcfile_l.c: $(srcdir)/rcfile_l.l
$(srcdir)/rcfile_y.c: $(srcdir)/rcfile_y.y
parser = $(srcdir)/rcfile_l.l $(srcdir)/rcfile_y.y
-headers = $(srcdir)/fetchmail.h $(srcdir)/socket.h $(srcdir)/smtp.h \
+headers = $(srcdir)/fetchmail.h $(srcdir)/smtp.h \
$(srcdir)/mx.h $(srcdir)/md5.h $(srcdir)/md5global.h
extra = $(srcdir)/alloca.c $(srcdir)/getopt.[ch] $(srcdir)/getopt1.c \
$(srcdir)/strcasecmp.c
diff --git a/driver.c b/driver.c
index 58a0dfa8..0c20746b 100644
--- a/driver.c
+++ b/driver.c
@@ -36,7 +36,6 @@
#include <netinet/in.h> /* must be included before "socket.h".*/
#include <netdb.h>
#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);
diff --git a/fetchmail.h b/fetchmail.h
index eaf11fb0..ee28098a 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -186,6 +186,8 @@ int openmailpipe (char **);
int closemailpipe(int);
int daemonize(const char *, void (*)(int));
+FILE *Socket(char *, int);
+
int prc_parse_file(const char *);
int prc_filecheck(const char *);
diff --git a/imap.c b/imap.c
index bb2e01bd..3ff1a57c 100644
--- a/imap.c
+++ b/imap.c
@@ -13,7 +13,6 @@
#if defined(STDC_HEADERS)
#include <stdlib.h>
#endif
-#include "socket.h"
#include "fetchmail.h"
static int count, seen, recent, unseen;
diff --git a/pop2.c b/pop2.c
index 075ef22e..2a7d4839 100644
--- a/pop2.c
+++ b/pop2.c
@@ -11,7 +11,6 @@
#if defined(STDC_HEADERS)
#include <stdlib.h>
#endif
-#include "socket.h"
#include "fetchmail.h"
static int pound_arg, equal_arg;
diff --git a/pop3.c b/pop3.c
index 4f8f35f7..4e5afe4b 100644
--- a/pop3.c
+++ b/pop3.c
@@ -15,7 +15,6 @@
#include <stdlib.h>
#endif
-#include "socket.h"
#include "fetchmail.h"
#define PROTOCOL_ERROR {fputs("fetchmail: protocol error\n", stderr); return(PS_ERROR);}
diff --git a/smtp.c b/smtp.c
index 66d47f81..1f509a48 100644
--- a/smtp.c
+++ b/smtp.c
@@ -13,7 +13,6 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include "socket.h"
#include "fetchmail.h"
#include "smtp.h"
diff --git a/socket.c b/socket.c
index 974fd70e..08f660ad 100644
--- a/socket.c
+++ b/socket.c
@@ -17,12 +17,14 @@
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
-#if defined(HAVE_STDARG_H)
-#include <stdarg.h>
+
+#ifndef INADDR_NONE
+#ifdef INADDR_BROADCAST
+#define INADDR_NONE INADDR_BROADCAST
#else
-#include <varargs.h>
+#define INADDR_NONE -1
+#endif
#endif
-#include "socket.h"
#define INTERNAL_BUFSIZE 2048
@@ -66,24 +68,4 @@ int clientPort;
return sockfp;
}
-int SockGets(buf, len, sockfp)
-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));
- }
-}
-
/* socket.c ends here */