]> The Tcpdump Group git mirrors - libpcap/commitdiff
Force strtok_r() to be declared if it's present.
authorGuy Harris <[email protected]>
Mon, 20 Mar 2017 17:46:45 +0000 (10:46 -0700)
committerGuy Harris <[email protected]>
Mon, 20 Mar 2017 17:46:45 +0000 (10:46 -0700)
portability.h
rpcapd/fileconf.c
rpcapd/rpcapd.c
sockutils.c

index 179ecd92d70bb09db83c7d6164269c93c7064828..bcaabae3e839a678f3cb239054664fdab9f43af9 100644 (file)
 
 #include "funcattrs.h"
 
+/*
+ * We include <string.h> ourselves, to make sure strtok_r() gets
+ * declared if we have it.
+ *
+ * On some UN*Xes we need to force it to be declared.
+ * We do *NOT* want to define _POSIX_C_SOURCE, as that tends
+ * to make non-POSIX APIs that we use unavailable.
+ * XXX - is there no portable way to say "please pollute the
+ * namespace to the maximum extent possible"?
+ */
+#if defined(sun) || defined(__sun)
+  #define __EXTENSIONS__
+#elif defined(_hpux) || defined(hpux) || defined(__hpux)
+  #define _REENTRANT
+#endif
+
+#include <string.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
index feb3ef4d4a217cdc42f1d9a0426756c7e583ee6e..5578d10aab35e34e4a426f584d86414edb7a726a 100755 (executable)
 #endif
 
 #include <stdio.h>
-#include <string.h>
 #include <signal.h>
 #include <pcap.h>              // for PCAP_ERRBUF_SIZE
 
-#include "portability.h"
+#include "portability.h"       // this includes <string.h>
 #include "rpcapd.h"
 #include "fileconf.h"
 #include "sockutils.h"         // for SOCK_ASSERT
index d1df031d5533a7eecfe608e6b14e4bd3c58f2a4b..a33ca6d2db68f338f98ecf65f6b1b24b1ea9cc19 100755 (executable)
 #endif
 
 #include <errno.h>             // for the errno variable
-#include <string.h>            // for strtok, etc
 #include <stdlib.h>            // for malloc(), free(), ...
 #include <pcap.h>              // for PCAP_ERRBUF_SIZE
 #include <signal.h>            // for signal()
 #include <pthread.h>
 
-#include "portability.h"
+#include "portability.h"       // this includes <string.h>
 #include "rpcapd.h"
 #include "fileconf.h"          // for the configuration file management
 #include "sockutils.h"         // for socket calls
index 97a7da20a8578910d190b356a7574945f5f54f63..a19f1081e0883718c48c1ee42d88b2e0dc9bf26f 100644 (file)
@@ -50,7 +50,6 @@
  * ways.
  */
 
-#include <string.h>    /* for strerror() */
 #include <errno.h>     /* for the errno variable */
 #include <stdio.h>     /* for the stderr file */
 #include <stdlib.h>    /* for malloc() and free() */
@@ -60,7 +59,7 @@
 #define INT_MAX                2147483647
 #endif
 
-#include "portability.h"
+#include "portability.h"       /* this includes <string.h> */
 #include "sockutils.h"
 
 #ifdef _WIN32