From 4c2423a98542de4ab80ff75cb5987aa59f788ee1 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 15 Oct 1996 14:48:34 +0000 Subject: Simplify the autoconfig process a lot. svn path=/trunk/; revision=337 --- Makefile.in | 2 +- configure.in | 14 ++------------ driver.c | 13 +++++++++---- fetchmail.h | 8 ++++++++ socket.c | 29 ++++++++++++++--------------- uid.c | 2 +- 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 [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. diff --git a/driver.c b/driver.c index 594f39ae..f9e53e91 100644 --- a/driver.c +++ b/driver.c @@ -14,7 +14,7 @@ #include #include #include -#ifdef QNX +#if defined(HAVE_STDARG_H) #include #else #include @@ -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 *); diff --git a/socket.c b/socket.c index 24d86ee8..1a6c6047 100644 --- a/socket.c +++ b/socket.c @@ -26,13 +26,12 @@ #if defined(HAVE_UNISTD_H) #include #endif -#if defined(QNX) -#include +#if defined(HAVE_STDARG_H) #include #else -#include -#endif #include +#endif +#include #include #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)); + } diff --git a/uid.c b/uid.c index 186d4b35..676850c1 100644 --- a/uid.c +++ b/uid.c @@ -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; } diff --git a/xmalloc.c b/xmalloc.c index 3679b508..9ea57c41 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -13,6 +13,7 @@ #include #include +#include #include #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; +} -- cgit v1.2.3