#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
#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
#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
* 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() */
#define INT_MAX 2147483647
#endif
-#include "portability.h"
+#include "portability.h" /* this includes <string.h> */
#include "sockutils.h"
#ifdef _WIN32