]> Pileus Git - ~andy/fetchmail/commitdiff
Eliminated socket.h.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 4 Nov 1996 17:00:46 +0000 (17:00 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 4 Nov 1996 17:00:46 +0000 (17:00 -0000)
svn path=/trunk/; revision=480

Makefile.in
driver.c
fetchmail.h
imap.c
pop2.c
pop3.c
smtp.c
socket.c

index a1524a0a08a6cb57ea7f976747962f24b3c353fa..96c4013ed7b17cdef22ce5c383befc10bdff3dba 100644 (file)
@@ -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
index 58a0dfa8c7f186b37927bb648fa949928818cdb2..0c20746ba989ea05d013313528e82fdc0f820c94 100644 (file)
--- 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);
 
index eaf11fb0481519ed8f50357793b1d45b96a5bb47..ee28098a68dd261f0fa5c30745d21341286583e2 100644 (file)
@@ -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 bb2e01bdab29a763afa253106a9f362017aba22c..3ff1a57c397778b8ebff55fe81c5c140d7c72e81 100644 (file)
--- 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 075ef22e8e0322870b468f64d2a9e1504911fd22..2a7d4839eb992495c3765ec04ff77623f4100348 100644 (file)
--- 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 4f8f35f767670a5a6c45de0113bfba9d134c996e..4e5afe4bad848d89f35783f0fdbfa7e222c0f008 100644 (file)
--- 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 66d47f813d347278e32cfba743785dc36e4c64b2..1f509a4838afda84a1b18224fb3b2ce11f8ce077 100644 (file)
--- 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"
 
index 974fd70e51ae7091843e281cca4ce06eacd14d8e..08f660ad3cb64e13eee7deede43a80cf49ef4cb5 100644 (file)
--- a/socket.c
+++ b/socket.c
 #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 */