]> Pileus Git - ~andy/fetchmail/commitdiff
Remove some obsolete constructs...
authorMatthias Andree <matthias.andree@gmx.de>
Wed, 31 Mar 2010 23:22:44 +0000 (01:22 +0200)
committerMatthias Andree <matthias.andree@gmx.de>
Sun, 12 Dec 2010 00:27:50 +0000 (01:27 +0100)
such as STDC_HEADERS, HAVE_UNISTD_H, termio.h, sgtty.h.

23 files changed:
conf.c
configure.ac
cram.c
daemon.c
driver.c
env.c
fetchmail.c
getpass.c
gssapi.c
imap.c
interface.c
kerberos.c
lock.c
md5ify.c
opie.c
options.c
pop3.c
rcfile_y.y
sink.c
socket.c
transact.c
uid.c
xmalloc.c

diff --git a/conf.c b/conf.c
index 5b834be0402d748335fd1e4098c5a2417f0d451b..d21dec1c30075e589959f6ead2d141af2b654e4c 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -9,12 +9,8 @@
 
 #include <stdio.h>
 #include <ctype.h>
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #include <string.h>
 #include <pwd.h>
 #include <errno.h>
index 44756c4da5cadb021bfe85e91146983482ecbf0c..99a454790d4efc72cc51316ee485a4981f127740 100644 (file)
@@ -57,12 +57,11 @@ if test "x$SHELL" = "x" ; then
 fi
 
 
-AC_HEADER_STDC
 AC_HEADER_TIME
 AC_TYPE_SIZE_T
 AC_TYPE_PID_T
 AC_TYPE_SIGNAL
-AC_CHECK_HEADERS([unistd.h termios.h termio.h sgtty.h stdarg.h \
+AC_CHECK_HEADERS([stdarg.h \
        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])
@@ -261,7 +260,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 #ifdef WEXITSTATUS
 /* Some POSIXoid systems have both the new-style macros and the old
    union wait type, and they do not work together.  If union wait
-   conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
+   conflicts with WEXITSTATUS et al, we do not want to use it at all.  */
 if (WEXITSTATUS (status) != 0) pid = -1;
 #endif
 #ifdef HAVE_WAITPID
@@ -273,9 +272,8 @@ pid = waitpid (-1, &status, 0);
 AC_MSG_CHECKING(sys_siglist declaration in signal.h or unistd.h)
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>
 /* NetBSD declares sys_siglist in <unistd.h>.  */
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif]], [[char *msg = *(sys_siglist + 1);]])],[AC_DEFINE(SYS_SIGLIST_DECLARED,1,[Define if 'sys_siglist' is declared by <signal.h>.]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
+]], [[char *msg = *(sys_siglist + 1);]])],[AC_DEFINE(SYS_SIGLIST_DECLARED,1,[Define if 'sys_siglist' is declared by <signal.h>.]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
 
 # Find the right directory to put the root-mode PID file in
 for dir in "/var/run" "/etc"
diff --git a/cram.c b/cram.c
index cf33393ebb9662e6a69ae8eb4352d35ee6c3570e..3c5630df6f1fe2ee0bc4c89cba9b3b36c21978a7 100644 (file)
--- a/cram.c
+++ b/cram.c
@@ -8,9 +8,7 @@
 #include  <stdio.h>
 #include  <string.h>
 #include  <ctype.h>
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
-#endif
 #include  "fetchmail.h"
 #include  "socket.h"
 
index e96abb4b5649e490617f9e980cf55c4d8c6c7242..696d533268eaa2bd2b2aa03362ef5006fbdcb8b0 100644 (file)
--- a/daemon.c
+++ b/daemon.c
 #endif /* !HAVE_FCNTL_H */
 #include <sys/stat.h>  /* get umask(2) prototyped */
 
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
-#endif
-
-#if defined(QNX)
-#include <unix.h>
-#endif
 
-#if !defined(HAVE_SETSID) && defined(SIGTSTP)
-#if defined(HAVE_TERMIOS_H)
-#  include <termios.h>         /* for TIOCNOTTY under Linux */
-#endif
-
-#if !defined(TIOCNOTTY) && defined(HAVE_SGTTY_H)
-#  include <sgtty.h>           /* for TIOCNOTTY under NEXTSTEP */
-#endif
-#endif /* !defined(HAVE_SETSID) && defined(SIGTSTP) */
+#include <termios.h>           /* for TIOCNOTTY under Linux */
 
 /* BSD portability hack */
 #if !defined(SIGCHLD) && defined(SIGCLD)
@@ -92,37 +76,23 @@ SIGHANDLERTYPE set_signal_handler(int sig, SIGHANDLERTYPE handler)
  */
 {
   SIGHANDLERTYPE rethandler;
-#ifdef HAVE_SIGACTION
   struct sigaction sa_new, sa_old;
 
   memset (&sa_new, 0, sizeof sa_new);
   sigemptyset (&sa_new.sa_mask);
   sa_new.sa_handler = handler;
   sa_new.sa_flags = 0;
-#ifdef SA_RESTART      /* SunOS 4.1 portability hack */
   /* system call should restart on all signals except SIGALRM */
   if (sig != SIGALRM)
       sa_new.sa_flags |= SA_RESTART;
-#endif
-#ifdef SA_NOCLDSTOP    /* SunOS 4.1 portability hack */
   if (sig == SIGCHLD)
       sa_new.sa_flags |= SA_NOCLDSTOP;
-#endif
   sigaction(sig, &sa_new, &sa_old);
   rethandler = sa_old.sa_handler;
 #if defined(SIGPWR)
   if (sig == SIGCHLD)
      sigaction(SIGPWR, &sa_new, NULL);
 #endif
-#else /* HAVE_SIGACTION */
-  rethandler = signal(sig, handler);
-#if defined(SIGPWR)
-  if (sig == SIGCHLD)
-      signal(SIGPWR, handler);
-#endif
-  /* system call should restart on all signals except SIGALRM */
-  siginterrupt(sig, sig == SIGALRM);
-#endif /* HAVE_SIGACTION */
   return rethandler;
 }
 
@@ -170,34 +140,11 @@ daemonize (const char *logfile)
   /* Make ourselves the leader of a new process group with no
      controlling terminal */
 
-#if    defined(HAVE_SETSID)            /* POSIX */
   /* POSIX makes this soooo easy to do */
   if (setsid() < 0) {
     report(stderr, "setsid (%s)\n", strerror(errno));
     return(PS_IOERR);
   }
-#elif  defined(SIGTSTP)                /* BSD */
-  /* change process group */
-  setpgrp(0, getpid());
-  /* lose controlling tty */
-  if ((fd = open("/dev/tty", O_RDWR)) >= 0) {
-    ioctl(fd, TIOCNOTTY, (char *) 0);
-    close(fd); /* not checking should be safe, there were no writes */
-  }
-#else                                  /* SVR3 and older */
-  /* change process group */
-  setpgrp();
-  
-  /* lose controlling tty */
-  set_signal_handler(SIGHUP, SIG_IGN);
-  if ((childpid = fork()) < 0) {
-    report(stderr, "fork (%s)\n", strerror(errno));
-    return(PS_IOERR);
-  }
-  else if (childpid > 0) {
-    exit(0);   /* parent */
-  }
-#endif
 
 nottyDetach:
 
index 2e4169cb787843837f0b59ede8d78cde073a6027..a086d1507a10d3fbeb9922b8a07c0e77e91e6839 100644 (file)
--- a/driver.c
+++ b/driver.c
 #ifdef HAVE_MEMORY_H
 #include  <memory.h>
 #endif /* HAVE_MEMORY_H */
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
 #include  <limits.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #if defined(HAVE_SYS_ITIMER_H)
 #include <sys/itimer.h>
 #endif
diff --git a/env.c b/env.c
index 3795460d5f6d692e1c109567e7549a631657a4f8..8293ad5f4195e7636fb016209ee7afada1c4991c 100644 (file)
--- a/env.c
+++ b/env.c
@@ -8,12 +8,8 @@
 #include "config.h"
 #include <stdio.h>
 #include <ctype.h>
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #include <pwd.h>
 #include <string.h>
 #ifdef HAVE_NET_SOCKET_H
index 2523f2bc48b1c7e103470da1414f39b6ed053dcf..4d1e7134db3dc4323a54dc9b247c13431f677a34 100644 (file)
@@ -6,12 +6,8 @@
 #include "config.h"
 
 #include <stdio.h>
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #include <fcntl.h>
 #include <string.h>
 #include <signal.h>
index 3c19ba7c832fb9f3825c3b98c6d29e7cd5024351..c3e9723e96130f34c3c20a886b3c3b3a642fe633 100644 (file)
--- a/getpass.c
+++ b/getpass.c
 #include <signal.h>
 #include <fcntl.h>
 #include <stdlib.h>
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #include "fetchmail.h"
 #include "i18n.h"
 
 #define INPUT_BUF_SIZE PASSWORDLEN
 
-#if defined(HAVE_TERMIOS_H) && defined(HAVE_TCSETATTR)
-#  include <termios.h>
-#else
-#if defined(HAVE_TERMIO_H)
-#  include <sys/ioctl.h>
-#  include <termio.h>
-#else
-#if defined(HAVE_SGTTY_H)
-#  include <sgtty.h>
-#endif
-#endif
-#endif
+#include <termios.h>
 
 static int ttyfd;
 
-#if defined(HAVE_TCSETATTR)
-  static struct termios termb;
-  static tcflag_t flags;
-#else
-#if defined(HAVE_TERMIO_H)
-  static struct termio termb;
-  static unsigned short flags;
-#else
-#if defined(HAVE_STTY)
-  static struct sgttyb ttyb;
-  static int flags;
-#endif
-#endif
-#endif
+static struct termios termb;
+static tcflag_t flags;
 
 static void save_tty_state(void);
 static void disable_tty_echo(void);
@@ -63,15 +38,6 @@ static RETSIGTYPE sigint_handler(int);
 
 char *fm_getpassword(char *prompt)
 {
-#if !(defined(HAVE_TCSETATTR) || defined(HAVE_TERMIO_H) || defined(HAVE_STTY))
-#if defined(HAVE_GETPASS) 
-    char *getpass();
-    return getpass(prompt);
-#else
-    fputs(GT_("ERROR: no support for getpassword() routine\n"),stderr);
-    exit(1);
-#endif
-#else
     register char *p;
     register int c;
     FILE *fi;
@@ -133,57 +99,26 @@ char *fm_getpassword(char *prompt)
        fclose(fi);     /* not checking should be safe, file mode was "r" */
 
     return(pbuf);
-#endif /* !(defined(HAVE_TCSETATTR) || ... */
 }
 
 static void save_tty_state (void)
 {
-#if defined(HAVE_TCSETATTR)
     tcgetattr(ttyfd, &termb);
     flags = termb.c_lflag;
-#else
-#if defined(HAVE_TERMIO_H)
-    ioctl(ttyfd, TCGETA, (char *) &termb);
-    flags = termb.c_lflag;
-#else  /* we HAVE_STTY */
-    gtty(ttyfd, &ttyb);
-    flags = ttyb.sg_flags;
-#endif
-#endif
 }
 
 static void disable_tty_echo(void) 
 {
     /* turn off echo on the tty */
-#if defined(HAVE_TCSETATTR)
     termb.c_lflag &= ~ECHO;
     tcsetattr(ttyfd, TCSAFLUSH, &termb);
-#else
-#if defined(HAVE_TERMIO_H)
-    termb.c_lflag &= ~ECHO;
-    ioctl(ttyfd, TCSETA, (char *) &termb);
-#else  /* we HAVE_STTY */
-    ttyb.sg_flags &= ~ECHO;
-    stty(ttyfd, &ttyb);
-#endif
-#endif
 }
 
 static void restore_tty_state(void)
 {
     /* restore previous tty echo state */
-#if defined(HAVE_TCSETATTR)
     termb.c_lflag = flags;
     tcsetattr(ttyfd, TCSAFLUSH, &termb);
-#else
-#if defined(HAVE_TERMIO_H)
-    termb.c_lflag = flags;
-    ioctl(ttyfd, TCSETA, (char *) &termb);
-#else  /* we HAVE_STTY */
-    ttyb.sg_flags = flags;
-    stty(ttyfd, &ttyb);
-#endif
-#endif
 }
 
 static RETSIGTYPE sigint_handler(int signum)
index 5a05ff8f9364b92683dafc4c7a4794ecacf07e14..57eb7bc7921c335777e584752b28f3e22e92f921 100644 (file)
--- a/gssapi.c
+++ b/gssapi.c
@@ -8,9 +8,7 @@
 #include  <stdio.h>
 #include  <string.h>
 #include  <ctype.h>
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
-#endif
 #include  "fetchmail.h"
 #include  "socket.h"
 
diff --git a/imap.c b/imap.c
index 1364027f03a496796fbdf4c9fd32727c3e4c81c5..39411e859257e3ada9ea387041387cbdc14fdcbf 100644 (file)
--- a/imap.c
+++ b/imap.c
 #include  <string.h>
 #include  <strings.h>
 #include  <ctype.h>
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
 #include  <limits.h>
 #include  <errno.h>
-#endif
 #include  "fetchmail.h"
 #include  "socket.h"
 
index 8c36bc8c765278f272000f61aa7b96ce89d59acc..f2e709690af4a53429d713485d3dae2112cc127d 100644 (file)
 
 #include <stdio.h>
 #include <string.h>
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
index a57616a8c72b245af888f6c967df8b80a7ba3bee..1125ec9c1349421081382ffc05ed2ac9d1b5a1f2 100644 (file)
@@ -10,9 +10,7 @@
 #include  <stdio.h>
 #include  <string.h>
 #include  <ctype.h>
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
-#endif
 #include  "fetchmail.h"
 #include  "socket.h"
 #include  "kerberos.h"
diff --git a/lock.c b/lock.c
index 213969f1f012f323c470ceb3a1e6b1c1aec43ffa..b6c1109fc922f7d9c6c4576a684babc9d6909e6e 100644 (file)
--- a/lock.c
+++ b/lock.c
@@ -6,15 +6,9 @@
 #include "config.h"
 
 #include <stdio.h>
-#ifdef HAVE_STRING_H
 #include <string.h> /* strcat() */
-#endif
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #include <errno.h>
 #include <fcntl.h>
 #include <signal.h>
index 5affe31651981b4f26e938f9cffbc664673b1da1..7634b0899d6cdcb3058cbdc43a15fe35bcaa9d5f 100644 (file)
--- a/md5ify.c
+++ b/md5ify.c
 
 #include <stdio.h>
 #include <string.h>
-
-#if defined(STDC_HEADERS)
 #include <string.h>
-#endif
 
 #include "fm_md5.h"
 
diff --git a/opie.c b/opie.c
index 0675612149c4703243ae611bef625a949c00885e..d3eabb9818d1e06841ad93eec54e7413abd40639 100644 (file)
--- a/opie.c
+++ b/opie.c
@@ -8,9 +8,7 @@
 #include  <stdio.h>
 #include  <string.h>
 #include  <ctype.h>
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
-#endif
 #include  "fetchmail.h"
 #include  "socket.h"
 
index 7f0d061de31b45e30416bd4781c97267f542d049..6d7e87a2b669800d2388c31de9ba937560c6db83 100644 (file)
--- a/options.c
+++ b/options.c
 #include <pwd.h>
 #include <string.h>
 #include <errno.h>
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
 #include  <limits.h>
-#else
-#include  <ctype.h>
-#endif
 
 #include "getopt.h"
 #include "fetchmail.h"
@@ -159,7 +155,6 @@ static const struct option longoptions[] = {
 static int xatoi(char *s, int *errflagptr)
 /* do safe conversion from string to number */
 {
-#if defined (STDC_HEADERS) && defined (LONG_MAX) && defined (INT_MAX)
     /* parse and convert numbers, but also check for invalid characters in
      * numbers
      */
@@ -190,41 +185,6 @@ static int xatoi(char *s, int *errflagptr)
     }
 
     return (int) value;  /* shut up, I know what I'm doing */
-#else
-    int        i;
-    char *dp;
-# if defined (STDC_HEADERS)
-    size_t     len;
-# else
-    int                len;
-# endif
-
-    /* We do only base 10 conversions here (atoi)! */
-
-    len = strlen(s);
-    /* check for leading white spaces */
-    for (i = 0; (i < len) && isspace((unsigned char)s[i]); i++)
-       ;
-
-    dp = &s[i];
-
-    /* check for +/- */
-    if (i < len && (s[i] == '+' || s[i] == '-'))       i++;
-
-    /* skip over digits */
-    for ( /* no init */ ; (i < len) && isdigit((unsigned char)s[i]); i++)
-       ;
-
-    /* check for trailing garbage */
-    if (i != len) {
-       (void) fprintf(stderr, GT_("String '%s' is not a valid number string.\n"), s);
-       (*errflagptr)++;
-       return 0;
-    }
-
-    /* atoi should be safe by now, except for number range over/underflow */
-    return atoi(dp);
-#endif
 }
 
 /** parse and validate the command line options */
diff --git a/pop3.c b/pop3.c
index a9b6b8bb1782b16f11aa12d4ede3c405cf456688..be7315bb6da2502dcfa33ab153d7aa257f1b9cb6 100644 (file)
--- a/pop3.c
+++ b/pop3.c
 #include  <stdio.h>
 #include  <string.h>
 #include  <ctype.h>
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
-#endif
 #include  <errno.h>
 
 #include  "fetchmail.h"
index c06a0fd46e6c444e82b901885b70a9b00f2cc26b..32ead41c802293a1465061d289dc69feaf05d6cc 100644 (file)
 #endif
 #include <sys/stat.h>
 #include <errno.h>
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #include <string.h>
 
 #if defined(__CYGWIN__)
diff --git a/sink.c b/sink.c
index 92f7b433d168ec1ea1db080f34cdf9d22aea5bdc..1fa168921378bde523b47a534dbb537c66623c02 100644 (file)
--- a/sink.c
+++ b/sink.c
 #ifdef HAVE_MEMORY_H
 #include  <memory.h>
 #endif /* HAVE_MEMORY_H */
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include  <unistd.h>
-#endif
 #if defined(HAVE_STDARG_H)
 #include  <stdarg.h>
 #else
index f974602a660bb56c806d5c5adaadd94b61d445a3..8a66d69ad2fe33f2cba927ad856b603a15c4fb95 100644 (file)
--- a/socket.c
+++ b/socket.c
 #include <arpa/inet.h>
 #endif
 #include <netdb.h>
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #if defined(HAVE_STDARG_H)
 #include <stdarg.h>
 #else
index 0b942e25731118108874318f62880853c464d2cb..b401663d6be1c7089dcdea14eff02667a8ce38aa 100644 (file)
 #ifdef HAVE_MEMORY_H
 #include  <memory.h>
 #endif /* HAVE_MEMORY_H */
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 #if defined(HAVE_STDARG_H)
 #include  <stdarg.h>
 #else
diff --git a/uid.c b/uid.c
index 8a775b9c63f48b60997f834f2d0f4f86f92bbe20..5c70d8127407c6c564f7ca995087e5a518ea8ce7 100644 (file)
--- a/uid.c
+++ b/uid.c
 #include <errno.h>
 #include <stdio.h>
 #include <limits.h>
-#if defined(STDC_HEADERS)
 #include <stdlib.h>
 #include <string.h>
-#endif
-#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
-#endif
 
 #include "fetchmail.h"
 #include "i18n.h"
index c2ca4a66e932a32d99716d851914b13ca05da6f0..bcb625539765cbcd13aabf48fa29cf9671f8c5e8 100644 (file)
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -10,9 +10,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-#if defined(STDC_HEADERS)
 #include  <stdlib.h>
-#endif
 #include "fetchmail.h"
 #include "i18n.h"