]> Pileus Git - ~andy/fetchmail/commitdiff
Drop support for systems without stdarg.h
authorMatthias Andree <matthias.andree@gmx.de>
Wed, 31 Mar 2010 23:36:19 +0000 (01:36 +0200)
committerMatthias Andree <matthias.andree@gmx.de>
Sun, 12 Dec 2010 00:29:10 +0000 (01:29 +0100)
configure.ac
fetchmail.h
report.c
sink.c
socket.c
socket.h
transact.c

index 99a454790d4efc72cc51316ee485a4981f127740..fc9610c1072c52015bbe0320239a2c59db9629b5 100644 (file)
@@ -61,7 +61,7 @@ AC_HEADER_TIME
 AC_TYPE_SIZE_T
 AC_TYPE_PID_T
 AC_TYPE_SIGNAL
-AC_CHECK_HEADERS([stdarg.h \
+AC_CHECK_HEADERS([ \
        sys/itimer.h fcntl.h sys/fcntl.h memory.h sys/wait.h \
        arpa/inet.h arpa/nameser.h netinet/in.h net/socket.h netdb.h \
        sys/select.h sys/socket.h sys/time.h langinfo.h md5.h])
index 7f41050e1e70e05af712ec1c8ba2f4c1ae789f81..7b7ff606e834bd7cc5ac38a906ff07542122e1cd 100644 (file)
@@ -5,7 +5,6 @@
  * For license terms, see the file COPYING in this directory.
  */
 
-/* We need this for HAVE_STDARG_H, etc */
 #include "config.h"
 
 struct addrinfo;
@@ -486,7 +485,6 @@ extern const char *iana_charset;    /* IANA assigned charset name */
 #endif
 
 /* error.c: Error reporting */
-#if defined(HAVE_STDARG_H)
 void report_init(int foreground);
  /** Flush partial message, suppress program name tag for next report printout. */
 void report_flush(FILE *fp);
@@ -502,12 +500,6 @@ void report_complete (FILE *fp, const char *format, ...)
 void report_at_line (FILE *fp, int, const char *, unsigned int, const char *, ...)
     __attribute__ ((format (printf, 5, 6)))
     ;
-#else
-void report ();
-void report_build ();
-void report_complete ();
-void report_at_line ();
-#endif
 
 /* driver.c -- main driver loop */
 void set_timeout(int);
@@ -524,7 +516,6 @@ int readheaders(int sock,
                       int num,
                       flag *suppress_readbody);
 int readbody(int sock, struct query *ctl, flag forward, int len);
-#if defined(HAVE_STDARG_H)
 void gen_send(int sock, const char *, ... )
     __attribute__ ((format (printf, 2, 3)))
     ;
@@ -532,11 +523,6 @@ int gen_recv(int sock, char *buf, int size);
 int gen_transact(int sock, const char *, ... )
     __attribute__ ((format (printf, 2, 3)))
     ;
-#else
-void gen_send();
-int gen_recv();
-int gen_transact();
-#endif
 extern struct msgblk msgblk;
 
 /* use these to track what was happening when the nonresponse timer fired */
@@ -577,13 +563,9 @@ int open_sink(struct query*, struct msgblk *, int*, int*);
 void release_sink(struct query *);
 int close_sink(struct query *, struct msgblk *, flag);
 int open_warning_by_mail(struct query *);
-#if defined(HAVE_STDARG_H)
 void stuff_warning(const char *, struct query *, const char *, ... )
     __attribute__ ((format (printf, 3, 4)))
     ;
-#else
-void stuff_warning();
-#endif
 void close_warning_by_mail(struct query *, struct msgblk *);
 
 /* rfc822.c: RFC822 header parsing */
index 5d9abb73a8332bb48d0fc13dc4afd54494869016..d39f1f74d4af7b60db31fdebbe01c3e77d876d10 100644 (file)
--- a/report.c
+++ b/report.c
 #include "i18n.h"
 #include "fetchmail.h"
 
-#if defined(HAVE_VPRINTF) || defined(HAVE_DOPRNT) || defined(_LIBC) || defined(HAVE_STDARG_H)
-# if HAVE_STDARG_H
 #  include <stdarg.h>
-#  define VA_START(args, lastarg) va_start(args, lastarg)
-# else
-#  include <varargs.h>
-#  define VA_START(args, lastarg) va_start(args)
-# endif
-#else
-# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
-# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
-#endif
 
 #define MALLOC(n)      xmalloc(n)      
 #define REALLOC(n,s)   xrealloc(n,s)   
@@ -48,42 +37,11 @@ static int partial_suppress_tag = 0;
 static unsigned unbuffered;
 static unsigned int use_syslog;
 
-#ifdef _LIBC
-/* In the GNU C library, there is a predefined variable for this.  */
-
-# define program_name program_invocation_name
-# include <errno.h>
-
-#else
-
-# if !HAVE_STRERROR && !defined(strerror)
-char *strerror (int errnum)
-{
-    extern char *sys_errlist[];
-    extern int sys_nerr;
-
-    if (errnum > 0 && errnum <= sys_nerr)
-       return sys_errlist[errnum];
-    return GT_("Unknown system error");
-}
-# endif        /* HAVE_STRERROR */
-#endif /* _LIBC */
-
 /* Print the program name and error message MESSAGE, which is a printf-style
    format string with optional args. */
-/* VARARGS */
-void
-#ifdef HAVE_STDARG_H
-report (FILE *errfp, const char *message, ...)
-#else
-report (FILE *errfp, message, va_alist)
-     const char *message;
-     va_dcl
-#endif
+void report(FILE *errfp, const char *message, ...)
 {
-#ifdef VA_START
     va_list args;
-#endif
 
     /* If a partially built message exists, print it now so it's not lost.  */
     if (partial_message_size_used != 0)
@@ -97,9 +55,7 @@ report (FILE *errfp, message, va_alist)
     {
        int priority;
 
-#ifdef VA_START
-       VA_START (args, message);
-#endif
+       va_start (args, message);
        priority = (errfp == stderr) ? LOG_ERR : LOG_INFO;
 
 #ifdef HAVE_VSYSLOG
@@ -118,9 +74,7 @@ report (FILE *errfp, message, va_alist)
        }
 #endif
 
-#ifdef VA_START
        va_end(args);
-#endif
     }
     else /* i. e. not using syslog */
 #endif
@@ -134,17 +88,9 @@ report (FILE *errfp, message, va_alist)
                fprintf (errfp, "%s: ", program_name);
        partial_suppress_tag = 0;
 
-#ifdef VA_START
-       VA_START (args, message);
-# if defined(HAVE_VPRINTF) || defined(_LIBC)
+       va_start (args, message);
        vfprintf (errfp, message, args);
-# else
-       _doprnt (message, args, errfp);
-# endif
        va_end (args);
-#else
-       fprintf (errfp, message, a1, a2, a3, a4, a5, a6, a7, a8);
-#endif
        fflush (errfp);
     }
 }
@@ -234,48 +180,15 @@ static void report_vbuild(const char *message, va_list args)
 }
 #endif
 
-void
-#ifdef HAVE_STDARG_H
-report_build (FILE *errfp, const char *message, ...)
-#else
-report_build (FILE *errfp, message, va_alist)
-     const char *message;
-     va_dcl
-#endif
+void report_build (FILE *errfp, const char *message, ...)
 {
-#ifdef VA_START
     va_list args;
-#else
-    int n;
-#endif
 
     rep_ensuresize();
 
-#if defined(VA_START)
     VA_START(args, message);
     report_vbuild(message, args);
     va_end(args);
-#else
-    for ( ; ; )
-    {
-       n = snprintf (partial_message + partial_message_size_used,
-                     partial_message_size - partial_message_size_used,
-                     message, a1, a2, a3, a4, a5, a6, a7, a8);
-
-       /* output error, f. i. EILSEQ */
-       if (n < 0) break;
-
-       if (n >= 0
-           && (unsigned)n < partial_message_size - partial_message_size_used)
-        {
-           partial_message_size_used += n;
-           break;
-       }
-
-       partial_message_size += 2048;
-       partial_message = REALLOC (partial_message, partial_message_size);
-    }
-#endif
 
     if (unbuffered && partial_message_size_used != 0)
     {
@@ -299,28 +212,15 @@ void report_flush(FILE *errfp)
    be empty.)  The completed report message is then printed (and reset to
    empty.) */
 /* VARARGS */
-void
-#ifdef HAVE_STDARG_H
-report_complete (FILE *errfp, const char *message, ...)
-#else
-report_complete (FILE *errfp, message, va_alist)
-     const char *message;
-     va_dcl
-#endif
+void report_complete (FILE *errfp, const char *message, ...)
 {
-#ifdef VA_START
     va_list args;
-#endif
 
     rep_ensuresize();
 
-#if defined(VA_START)
     VA_START(args, message);
     report_vbuild(message, args);
     va_end(args);
-#else
-    report_build(errfp, message, a1, a2, a3, a4, a5, a6, a7, a8);
-#endif
 
     /* Finally... print it.  */
     partial_message_size_used = 0;
@@ -339,22 +239,10 @@ report_complete (FILE *errfp, message, va_alist)
 static int error_one_per_line;
 
 /* If errnum is nonzero, print its corresponding system error message. */
-void
-#ifdef HAVE_STDARG_H
-report_at_line (FILE *errfp, int errnum, const char *file_name,
+void report_at_line (FILE *errfp, int errnum, const char *file_name,
               unsigned int line_number, const char *message, ...)
-#else
-report_at_line (FILE *errfp, errnum, file_name, line_number, message, va_alist)
-     int errnum;
-     const char *file_name;
-     unsigned int line_number;
-     const char *message;
-     va_dcl
-#endif
 {
-#ifdef VA_START
     va_list args;
-#endif
 
     if (error_one_per_line)
     {
@@ -381,17 +269,9 @@ report_at_line (FILE *errfp, errnum, file_name, line_number, message, va_alist)
     if (file_name != NULL)
        fprintf (errfp, "%s:%u: ", file_name, line_number);
 
-#ifdef VA_START
-    VA_START (args, message);
-# if defined(HAVE_VPRINTF) || defined(_LIBC)
+    va_start (args, message);
     vfprintf (errfp, message, args);
-# else
-    _doprnt (message, args, errfp);
-# endif
     va_end (args);
-#else
-    fprintf (errfp, message, a1, a2, a3, a4, a5, a6, a7, a8);
-#endif
 
     if (errnum)
        fprintf (errfp, ": %s", strerror (errnum));
diff --git a/sink.c b/sink.c
index 1fa168921378bde523b47a534dbb537c66623c02..0456c80051ce2e950b4fc916feac4721007cbbb3 100644 (file)
--- a/sink.c
+++ b/sink.c
 #endif /* HAVE_MEMORY_H */
 #include  <stdlib.h>
 #include  <unistd.h>
-#if defined(HAVE_STDARG_H)
 #include  <stdarg.h>
-#else
-#include  <varargs.h>
-#endif
 #include  <ctype.h>
 #include  <langinfo.h>
 
@@ -1572,15 +1568,7 @@ int open_warning_by_mail(struct query *ctl)
 /* if rfc2047charset is non-NULL, encode the line (that is assumed to be
  * a header line) as per RFC-2047 using rfc2047charset as the character
  * set field */
-#if defined(HAVE_STDARG_H)
 void stuff_warning(const char *rfc2047charset, struct query *ctl, const char *fmt, ... )
-#else
-void stuff_warning(rfc2047charset, ctl, fmt, va_alist)
-const char *charset;
-struct query *ctl;
-const char *fmt;       /* printf-style format */
-va_dcl
-#endif
 {
     /* make huge -- i18n can bulk up error messages a lot */
     char       buf[2*MSGBUFSIZE+4];
@@ -1592,11 +1580,7 @@ va_dcl
      * case it was a string constant.  We make a virtue of that necessity
      * here by supporting stdargs/varargs.
      */
-#if defined(HAVE_STDARG_H)
     va_start(ap, fmt) ;
-#else
-    va_start(ap);
-#endif
     vsnprintf(buf, sizeof(buf) - 2, fmt, ap);
     va_end(ap);
 
index 8a66d69ad2fe33f2cba927ad856b603a15c4fb95..1da4d4c1a513f3ac8059f4f7b23881b28021031d 100644 (file)
--- a/socket.c
+++ b/socket.c
 #include <netdb.h>
 #include <stdlib.h>
 #include <unistd.h>
-#if defined(HAVE_STDARG_H)
 #include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>
@@ -349,28 +345,15 @@ int SockOpen(const char *host, const char *service,
 }
 
 
-#if defined(HAVE_STDARG_H)
 int SockPrintf(int sock, const char* format, ...)
 {
-#else
-int SockPrintf(sock,format,va_alist)
-int sock;
-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
     vsnprintf(buf, sizeof(buf), format, ap);
     va_end(ap);
     return SockWrite(sock, buf, strlen(buf));
-
 }
 
 #ifdef SSL_ENABLE
index 81b56c0690c40146a2d3edbfd99de523435eb33e..a77ceb8d83972daeb10dfecb5eaa8dbad1956d6a 100644 (file)
--- a/socket.h
+++ b/socket.h
@@ -55,13 +55,9 @@ int SockWrite(int sock, const char *buf, int size);
 Send formatted output to the socket (matches interface of fprintf).
 Returns number of bytes successfully written.
 */
-#if defined(HAVE_STDARG_H)
 int SockPrintf(int sock, const char *format, ...)
     __attribute__ ((format (printf, 2, 3)))
     ;
-#else
-int SockPrintf();
-#endif
  
 /**
 Close a socket previously opened by SockOpen.  This allows for some
index b401663d6be1c7089dcdea14eff02667a8ce38aa..a86589a7ad38cb12f1d4a974a20e3872cff1fd62 100644 (file)
 #endif /* HAVE_MEMORY_H */
 #include  <stdlib.h>
 #include <unistd.h>
-#if defined(HAVE_STDARG_H)
 #include  <stdarg.h>
-#else
-#include  <varargs.h>
-#endif
 #include <limits.h>
 
 #ifdef HAVE_NET_SOCKET_H
@@ -1499,14 +1495,7 @@ static void enshroud(char *buf)
     }
 }
 
-#if defined(HAVE_STDARG_H)
 void gen_send(int sock, const char *fmt, ... )
-#else
-void gen_send(sock, fmt, va_alist)
-int sock;              /* socket to which server is connected */
-const char *fmt;       /* printf-style format */
-va_dcl
-#endif
 /* assemble command in printf(3) style and send to the server */
 {
     char buf [MSGBUFSIZE+1];
@@ -1517,11 +1506,7 @@ va_dcl
     else
        buf[0] = '\0';
 
-#if defined(HAVE_STDARG_H)
     va_start(ap, fmt);
-#else
-    va_start(ap);
-#endif
     vsnprintf(buf + strlen(buf), sizeof(buf)-2-strlen(buf), fmt, ap);
     va_end(ap);
 
@@ -1571,14 +1556,7 @@ int gen_recv(int sock  /** socket to which server is connected */,
     }
 }
 
-#if defined(HAVE_STDARG_H)
 int gen_transact(int sock, const char *fmt, ... )
-#else
-int gen_transact(int sock, fmt, va_alist)
-int sock;              /* socket to which server is connected */
-const char *fmt;       /* printf-style format */
-va_dcl
-#endif
 /* assemble command in printf(3) style, send to server, accept a response */
 {
     int ok;
@@ -1593,11 +1571,7 @@ va_dcl
     else
        buf[0] = '\0';
 
-#if defined(HAVE_STDARG_H)
     va_start(ap, fmt) ;
-#else
-    va_start(ap);
-#endif
     vsnprintf(buf + strlen(buf), sizeof(buf)-2-strlen(buf), fmt, ap);
     va_end(ap);