diff options
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | configure.in | 14 | ||||
-rw-r--r-- | driver.c | 13 | ||||
-rw-r--r-- | fetchmail.h | 8 | ||||
-rw-r--r-- | socket.c | 29 | ||||
-rw-r--r-- | uid.c | 2 | ||||
-rw-r--r-- | xmalloc.c | 12 |
7 files changed, 46 insertions, 34 deletions
diff --git a/Makefile.in b/Makefile.in index 24ca45e6..6d2d3801 100644 --- a/Makefile.in +++ b/Makefile.in @@ -206,7 +206,7 @@ parser = $(srcdir)/rcfile_l.l $(srcdir)/rcfile_y.y headers = $(srcdir)/fetchmail.h $(srcdir)/socket.h $(srcdir)/smtp.h \ $(srcdir)/md5.h $(srcdir)/md5global.h extra = $(srcdir)/alloca.c $(srcdir)/getopt.[ch] $(srcdir)/getopt1.c \ - $(srcdir)/strcasecmp.c $(srcdir)/strdup.c + $(srcdir)/strcasecmp.c docs = $(srcdir)/COPYING $(srcdir)/README $(srcdir)/INSTALL $(srcdir)/NEWS \ $(srcdir)/NOTES $(srcdir)/fetchmail.lsm $(srcdir)/RFC/*.txt \ $(srcdir)/*.man $(srcdir)/sample.rcfile diff --git a/configure.in b/configure.in index b52f6bbe..d9a0aa55 100644 --- a/configure.in +++ b/configure.in @@ -23,7 +23,7 @@ AC_HEADER_STDC AC_TYPE_SIZE_T AC_TYPE_PID_T AC_TYPE_SIGNAL -AC_CHECK_HEADERS(unistd.h termios.h termio.h sgtty.h memory.h) +AC_CHECK_HEADERS(unistd.h termios.h termio.h sgtty.h stdarg.h) AC_C_CONST dnl getopt needs this. @@ -34,10 +34,6 @@ AC_SUBST(LIBOBJS) AC_CHECK_LIB(socket,socket) AC_CHECK_LIB(nsl,inet_addr) -AC_CHECK_FUNC(strdup, AC_DEFINE(HAVE_STRDUP), - [EXTRASRC="$EXTRASRC \$(srcdir)/strdup.c" - EXTRAOBJ="$EXTRAOBJ strdup.o"]) - AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP), [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c" EXTRAOBJ="$EXTRAOBJ strcasecmp.o"]) @@ -65,7 +61,7 @@ dnl All AC_CHECK_FUNCs must precede the following AC_SUBSTs AC_SUBST(EXTRASRC) AC_SUBST(EXTRAOBJ) -AC_CHECK_FUNCS(dup2 strerror tcsetattr stty setsid rresvport) +AC_CHECK_FUNCS(tcsetattr stty setsid rresvport) dnl AC_FUNC_SETVBUF_REVERSED @@ -119,12 +115,6 @@ AC_TRY_LINK([#include <signal.h> [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) -# The presence of the following is not meant to imply -# that fetchmail necessarily works on those systems. -dnl AC_DYNIX_SEQ -dnl AC_XENIX_DIR -dnl AC_IRIX_SUN - AC_OUTPUT(Makefile, [ # Makefile uses this timestamp file to know when to remake Makefile, # build.sh, and glob/Makefile. @@ -14,7 +14,7 @@ #include <config.h> #include <stdio.h> #include <stdlib.h> -#ifdef QNX +#if defined(HAVE_STDARG_H) #include <stdarg.h> #else #include <varargs.h> @@ -846,7 +846,7 @@ closeUp: globals: reads outlevel. *********************************************************************/ -#if defined(QNX) +#if defined(HAVE_STDARG_H) void gen_send(int socket, char *fmt, ... ) { #else @@ -864,7 +864,7 @@ va_dcl { else buf[0] = '\0'; -#if defined(QNX) +#if defined(HAVE_STDARG_H) va_start(ap, fmt) ; #else va_start(ap); @@ -898,10 +898,15 @@ va_dcl { globals: reads outlevel. *********************************************************************/ +#if defined(HAVE_STDARG_H) +int gen_transact(int socket, char *fmt, ... ) +{ +#else int gen_transact(socket, fmt, va_alist) int socket; const char *fmt; va_dcl { +#endif int ok; char buf [POPBUFSIZE+1]; @@ -912,7 +917,7 @@ va_dcl { else buf[0] = '\0'; -#if defined(QNX) +#if defined(HAVE_STDARG_H) va_start(ap, fmt) ; #else va_start(ap); diff --git a/fetchmail.h b/fetchmail.h index 9819e6ba..cb181626 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -139,8 +139,16 @@ extern int versioninfo; /* emit only version info */ #ifdef HAVE_PROTOTYPES /* prototypes for globally callable functions */ +#if defined(HAVE_STDARG_H) +void gen_send (int socket, char *fmt, ... ); +int gen_transact (int socket, char *fmt, ... ); +#else void gen_send (); int gen_transact (); +#endif + +void *xmalloc(int); +char *xstrdup(char *); int doPOP2 (struct hostrec *); int doPOP3 (struct hostrec *); @@ -26,13 +26,12 @@ #if defined(HAVE_UNISTD_H) #include <unistd.h> #endif -#if defined(QNX) -#include <stdio.h> +#if defined(HAVE_STDARG_H) #include <stdarg.h> #else -#include <stdlib.h> -#endif #include <varargs.h> +#endif +#include <stdlib.h> #include <errno.h> #include "socket.h" @@ -187,24 +186,15 @@ int len; else { bcopy(bp,buf,len); sbuflen -= len; -#if defined(QNX) -int SockPrintf(int socket, char* format, ...) -{ -#else bp += len; } return(len); } -#endif /* SockClearHeader: call this procedure in order to kill off any forthcoming Header info from the socket that we no longer want. */ -#if defined(QNX) - va_start(ap, format) ; -#else int SockClearHeader(socket) -#endif int socket; { char *bufp; @@ -258,17 +248,26 @@ int SockDataWaiting(int socket) fcntl(socket,F_SETFL,flags); return res; } - +#if defined(HAVE_STDARG_H) +int SockPrintf(int socket, char* format, ...) +{ +#else int SockPrintf(socket,format,va_alist) int socket; char *format; va_dcl { +#endif va_list ap; char buf[8192]; - + +#if defined(HAVE_STDARG_H) + va_start(ap, format) ; +#else va_start(ap); +#endif vsprintf(buf, format, ap); va_end(ap); return SockWrite(socket, buf, strlen(buf)); + } @@ -117,7 +117,7 @@ char *str; new = (struct idlist *)xmalloc(sizeof(struct idlist)); new->num = num; - new->id = strdup(str); + new->id = xstrdup(str); new->next = *idl; *idl = new; } @@ -13,6 +13,7 @@ #include <config.h> #include <stdio.h> +#include <string.h> #include <sys/types.h> #include "fetchmail.h" @@ -24,7 +25,7 @@ XMALLOCTYPE * xmalloc (n) -size_t n; +int n; { XMALLOCTYPE *p; @@ -35,3 +36,12 @@ size_t n; } return(p); } + +char *xstrdup(s) +char *s; +{ + char *p; + p = (char *) xmalloc(strlen(s)+1); + strcpy(p,s); + return p; +} |