From 2986221cabd86740654e1868c61864ef82f430a5 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Mon, 24 Apr 2017 10:13:41 -0400 Subject: [PATCH] [core] sys-strings.h abstraction for strings.h --- SConstruct | 1 + configure.ac | 2 +- src/CMakeLists.txt | 1 + src/Makefile.am | 3 ++- src/http-header-glue.c | 1 + src/mod_compress.c | 2 +- src/mod_ssi.c | 2 +- src/sys-strings.h | 20 ++++++++++++++++++++ 8 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/sys-strings.h diff --git a/SConstruct b/SConstruct index 0d65d8b3..762fad1b 100644 --- a/SConstruct +++ b/SConstruct @@ -189,6 +189,7 @@ if 1: stdint.h stdlib.h string.h + strings.h sys/devpoll.h sys/epoll.h sys/event.h diff --git a/configure.ac b/configure.ac index b8b3eb17..e818cb5f 100644 --- a/configure.ac +++ b/configure.ac @@ -110,7 +110,7 @@ CPPFLAGS="${CPPFLAGS} -D_REENTRANT -D__EXTENSIONS__" dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h \ +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h strings.h \ sys/socket.h sys/time.h unistd.h sys/sendfile.h sys/uio.h \ getopt.h sys/epoll.h sys/select.h poll.h sys/poll.h sys/devpoll.h sys/filio.h \ sys/mman.h sys/event.h port.h pwd.h \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b37b192b..de14e0e0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -93,6 +93,7 @@ check_include_files(poll.h HAVE_POLL_H) check_include_files(pwd.h HAVE_PWD_H) check_include_files(stddef.h HAVE_STDDEF_H) check_include_files(stdint.h HAVE_STDINT_H) +check_include_files(strings.h HAVE_STRINGS_H) check_include_files(syslog.h HAVE_SYSLOG_H) # check for fastcgi lib, for the tests only diff --git a/src/Makefile.am b/src/Makefile.am index 9e4e050d..b07a9cb2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -381,7 +381,8 @@ hdr = server.h base64.h buffer.h network.h log.h keyvalue.h \ mod_ssi.h mod_ssi_expr.h inet_ntop_cache.h \ configparser.h mod_ssi_exprparser.h \ rand.h \ - sys-endian.h sys-mmap.h sys-socket.h mod_cml.h mod_cml_funcs.h \ + sys-endian.h sys-mmap.h sys-socket.h sys-strings.h \ + mod_cml.h mod_cml_funcs.h \ safe_memclear.h splaytree.h proc_open.h status_counter.h \ mod_magnet_cache.h diff --git a/src/http-header-glue.c b/src/http-header-glue.c index 535ef9ba..c308af06 100644 --- a/src/http-header-glue.c +++ b/src/http-header-glue.c @@ -16,6 +16,7 @@ #include +#include "sys-strings.h" #include "sys-socket.h" #ifndef _WIN32 #include diff --git a/src/mod_compress.c b/src/mod_compress.c index f08805dc..41ad68d1 100644 --- a/src/mod_compress.c +++ b/src/mod_compress.c @@ -13,12 +13,12 @@ #include #include +#include "sys-strings.h" #include #include #include #include -#include #include #include diff --git a/src/mod_ssi.c b/src/mod_ssi.c index bb76b379..3842bbe9 100644 --- a/src/mod_ssi.c +++ b/src/mod_ssi.c @@ -13,11 +13,11 @@ #include "sys-socket.h" #include +#include "sys-strings.h" #include #include #include -#include #include #include #include diff --git a/src/sys-strings.h b/src/sys-strings.h new file mode 100644 index 00000000..d4ff0f31 --- /dev/null +++ b/src/sys-strings.h @@ -0,0 +1,20 @@ +#ifndef LI_SYS_STRINGS_H +#define LI_SYS_STRINGS_H +#include "first.h" + +#if defined(HAVE_STRINGS_H) + +#include + +#else /* HAVE_STRINGS_H */ + +#ifdef _MSC_VER +#define strcasecmp(s1,s2) _stricmp(s1,s2) +#define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n) +#else +/* ??? */ +#endif + +#endif /* HAVE_STRINGS_H */ + +#endif -- 2.11.4.GIT