such as STDC_HEADERS, HAVE_UNISTD_H, termio.h, sgtty.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 <string.h>
#include <pwd.h>
#include <errno.h>
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])
#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
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"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#if defined(STDC_HEADERS)
#include <stdlib.h>
-#endif
#include "fetchmail.h"
#include "socket.h"
#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)
*/
{
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;
}
/* 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:
#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
#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
#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>
#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);
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;
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)
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#if defined(STDC_HEADERS)
#include <stdlib.h>
-#endif
#include "fetchmail.h"
#include "socket.h"
#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"
#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>
#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"
#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>
#include <stdio.h>
#include <string.h>
-
-#if defined(STDC_HEADERS)
#include <string.h>
-#endif
#include "fm_md5.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#if defined(STDC_HEADERS)
#include <stdlib.h>
-#endif
#include "fetchmail.h"
#include "socket.h"
#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"
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
*/
}
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 */
#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"
#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__)
#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
#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
#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
#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"
#include <stdio.h>
#include <errno.h>
#include <string.h>
-#if defined(STDC_HEADERS)
#include <stdlib.h>
-#endif
#include "fetchmail.h"
#include "i18n.h"