From 768b5edd9623b7238e12ec8dfc409b82a1ed9e2d Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Mon, 26 Mar 2012 22:12:41 +0200 Subject: [PATCH] Eliminate '#ifdef HAVE_FOO' for Posix-mandated FOOs. Update configure file for removal of POSIX-mandated header files. Merged from nmh. Thanks to Lyndon Nerenberg and Ken Hornstein. --- configure.ac | 18 +++--------------- h/nmh.h | 32 +++++--------------------------- h/prototypes.h | 8 -------- sbr/lock_file.c | 4 +--- uip/dropsbr.c | 6 +----- 5 files changed, 10 insertions(+), 58 deletions(-) diff --git a/configure.ac b/configure.ac index 4bedb05..5b2f640 100644 --- a/configure.ac +++ b/configure.ac @@ -340,11 +340,9 @@ AC_HEADER_TIME AC_HEADER_SYS_WAIT AC_HEADER_STAT AC_HEADER_TIOCGWINSZ -AC_CHECK_HEADERS(string.h memory.h stdlib.h unistd.h errno.h fcntl.h \ - limits.h crypt.h termcap.h termio.h termios.h locale.h \ - langinfo.h wchar.h wctype.h iconv.h netdb.h \ - sys/param.h sys/time.h sys/stream.h \ - arpa/inet.h arpa/ftp.h) +AC_CHECK_HEADERS(fcntl.h crypt.h termcap.h termio.h termios.h \ + langinfo.h wchar.h wctype.h iconv.h \ + sys/param.h sys/time.h sys/stream.h ) dnl dnl Checks for _IO_write_ptr. A Linuxism used by nmh on linux. We @@ -391,16 +389,6 @@ AC_EGREP_HEADER(initgroups, grp.h, AC_DEFINE(INITGROUPS_HEADER, ), AC_EGREP_HEADER(initgroups, unistd.h, AC_DEFINE(INITGROUPS_HEADER, ))) -dnl On AIX 4.1, snprintf() is defined in libc.a but there's no prototype in -dnl or elsewhere. Apparently it's not officially supported (though it -dnl seems to work perfectly and IBM apparently uses it in internal code). -dnl Anyhow, if we omit our own snprintf() and vsnprintf() prototypes when we -dnl HAVE_SNPRINTF, we get a billion warnings at compile time. Use the C -dnl preprocessor to preprocess stdio.h and make sure that there's actually a -dnl prototype. -AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_PROTOTYPE,1, - [Define to 1 if has a prototype for snprintf().])) - dnl Check for multibyte character set support if test "x$ac_cv_header_wchar_h" = "xyes" -a "x$ac_cv_header_wctype_h" = "xyes" \ -a "x$ac_cv_func_wcwidth" = "xyes" -a "x$ac_cv_func_mbtowc" = "xyes"; then diff --git a/h/nmh.h b/h/nmh.h index 896786f..19549e4 100644 --- a/h/nmh.h +++ b/h/nmh.h @@ -4,11 +4,7 @@ #include -#ifdef HAVE_UNISTD_H -# include -# include -#endif - +#include #include #include #include @@ -30,34 +26,16 @@ # endif #endif -#ifdef HAVE_STDLIB_H -# include -#endif - +#include #include - -#if STDC_HEADERS || HAVE_STRING_H -# include -/* An ANSI string.h and pre-ANSI memory.h might conflict. */ -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif /* not STDC_HEADERS and HAVE_MEMORY_H */ -#else /* not STDC_HEADERS and not HAVE_STRING_H */ -# include -/* memory.h and strings.h conflict on some systems. */ -#endif /* not STDC_HEADERS and not HAVE_STRING_H */ +#include #ifdef HAVE_SYS_PARAM_H # include #endif -#ifdef HAVE_LOCALE_H -# include -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif +#include +#include /* ** symbolic constants for lseek and fseek diff --git a/h/prototypes.h b/h/prototypes.h index bb4c38b..bd484e9 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -114,14 +114,6 @@ int vfgets(FILE *, char **); char *write_charset_8bit(void); int get_returnpath(char *, int, char *, int); -/* -** prototypes for compatibility functions in library -*/ -#ifndef HAVE_SNPRINTF_PROTOTYPE -int snprintf(char *, size_t, const char *, ...); -int vsnprintf(char *, size_t, const char *, va_list); -#endif - int mh_strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n); diff --git a/sbr/lock_file.c b/sbr/lock_file.c index b4a1547..983d9d7 100644 --- a/sbr/lock_file.c +++ b/sbr/lock_file.c @@ -30,9 +30,7 @@ # endif #endif -#ifdef HAVE_ERRNO_H -# include -#endif +#include #ifdef HAVE_FCNTL_H # include diff --git a/uip/dropsbr.c b/uip/dropsbr.c index 6a7eb78..124e5ab 100644 --- a/uip/dropsbr.c +++ b/uip/dropsbr.c @@ -12,11 +12,7 @@ #include #include #include - -#ifdef HAVE_ERRNO_H -# include -#endif - +#include #include -- 1.7.10.4