From 1656cd051c7f28de359b1f188b20a5a688004267 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 7 Jan 2023 21:59:16 -0500 Subject: [PATCH] Include globally Various code uses str{,n}casecmp() so include , if it exists, everywhere. * configure.ac: Check for explicitly. * src/makeint.h: Include it if HAVE_STRINGS_H, for str{,n}casecmp(). * src/job.c: Remove include of . * src/main.c: Ditto. --- configure.ac | 4 ++-- src/job.c | 3 --- src/main.c | 3 --- src/makeint.h | 6 ++++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 4de0076d..8466d36f 100644 --- a/configure.ac +++ b/configure.ac @@ -64,9 +64,9 @@ AC_SEARCH_LIBS([getpwnam], [sun]) AC_HEADER_DIRENT AC_HEADER_STAT -AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \ +AC_CHECK_HEADERS([stdlib.h string.h strings.h locale.h unistd.h limits.h \ memory.h sys/param.h sys/resource.h sys/timeb.h sys/time.h \ - sys/select.h sys/file.h spawn.h]) + sys/select.h sys/file.h fcntl.h spawn.h]) AM_PROG_CC_C_O AC_C_CONST diff --git a/src/job.c b/src/job.c index 35fbda00..a42c426c 100644 --- a/src/job.c +++ b/src/job.c @@ -30,9 +30,6 @@ this program. If not, see . */ /* Default shell to use. */ #ifdef WINDOWS32 -# ifdef HAVE_STRINGS_H -# include /* for strcasecmp, strncasecmp */ -# endif # include const char *default_shell = "sh.exe"; diff --git a/src/main.c b/src/main.c index 93fca9ac..4d4b88fe 100644 --- a/src/main.c +++ b/src/main.c @@ -34,9 +34,6 @@ this program. If not, see . */ #ifdef WINDOWS32 # include # include -#ifdef HAVE_STRINGS_H -# include /* for strcasecmp */ -#endif # include "pathstuff.h" # include "sub_proc.h" # include "w32err.h" diff --git a/src/makeint.h b/src/makeint.h index 4bcf7b77..b5f63b16 100644 --- a/src/makeint.h +++ b/src/makeint.h @@ -251,8 +251,6 @@ extern int vms_unix_simulation; # ifdef HAVE_STRING_H # include # define ANSI_STRING 1 -# else -# include # endif # ifdef HAVE_MEMORY_H # include @@ -296,6 +294,10 @@ char *strerror (int errnum); # include #endif +#if HAVE_STRINGS_H +# include /* Needed for strcasecmp / strncasecmp. */ +#endif + #if defined _MSC_VER || defined __MINGW32__ # define MK_PRI64_PREFIX "I64" #else