aboutsummaryrefslogtreecommitdiffstats
path: root/sharkd_daemon.c
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-02-19 04:54:33 +0000
committerMartin Kaiser <wireshark@kaiser.cx>2021-02-20 15:46:35 +0000
commit4d793fdd7a0df7f5617a38f521dffe47db4e5973 (patch)
tree9e16cc00fbd8b1592025a77997d2f4c8350bf40f /sharkd_daemon.c
parent166dcae76f5860fe19c706594c043a015f1f54b4 (diff)
sharkd: squelch redundant decl warnings
In file included from ../sharkd_daemon.c:31: ../wsutil/wsgetopt.h:38:21: warning: redundant redeclaration of ‘optarg’ [-Wredundant-decls] 38 | WS_DLL_PUBLIC char *optarg; | ^~~~~~ In file included from /usr/include/bits/getopt_posix.h:27, from /usr/include/unistd.h:883, from ../wsutil/socket.h:33, from ../sharkd_daemon.c:28: /usr/include/bits/getopt_core.h:36:14: note: previous declaration of ‘optarg’ was here 36 | extern char *optarg; | ^~~~~~ In file included from ../sharkd_daemon.c:31: ../wsutil/wsgetopt.h:52:19: warning: redundant redeclaration of ‘optind’ [-Wredundant-decls] 52 | WS_DLL_PUBLIC int optind; | ^~~~~~ In file included from /usr/include/bits/getopt_posix.h:27, from /usr/include/unistd.h:883, from ../wsutil/socket.h:33, from ../sharkd_daemon.c:28: /usr/include/bits/getopt_core.h:50:12: note: previous declaration of ‘optind’ was here 50 | extern int optind; | ^~~~~~ In file included from ../sharkd_daemon.c:31: ../wsutil/wsgetopt.h:57:19: warning: redundant redeclaration of ‘opterr’ [-Wredundant-decls] 57 | WS_DLL_PUBLIC int opterr; | ^~~~~~ In file included from /usr/include/bits/getopt_posix.h:27, from /usr/include/unistd.h:883, from ../wsutil/socket.h:33, from ../sharkd_daemon.c:28: /usr/include/bits/getopt_core.h:55:12: note: previous declaration of ‘opterr’ was here 55 | extern int opterr; | ^~~~~~ In file included from ../sharkd_daemon.c:31: ../wsutil/wsgetopt.h:61:19: warning: redundant redeclaration of ‘optopt’ [-Wredundant-decls] 61 | WS_DLL_PUBLIC int optopt; | ^~~~~~ In file included from /usr/include/bits/getopt_posix.h:27, from /usr/include/unistd.h:883, from ../wsutil/socket.h:33, from ../sharkd_daemon.c:28: /usr/include/bits/getopt_core.h:59:12: note: previous declaration of ‘optopt’ was here 59 | extern int optopt; | ^~~~~~ In file included from ../sharkd_daemon.c:31: ../wsutil/wsgetopt.h:131:19: warning: redundant redeclaration of ‘getopt’ [-Wredundant-decls] 131 | WS_DLL_PUBLIC int getopt (int ___argc, char *const *___argv, const char *__shortopts) | ^~~~~~ In file included from /usr/include/bits/getopt_posix.h:27, from /usr/include/unistd.h:883, from ../wsutil/socket.h:33, from ../sharkd_daemon.c:28: /usr/include/bits/getopt_core.h:91:12: note: previous declaration of ‘getopt’ was here 91 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) | ^~~~~~
Diffstat (limited to 'sharkd_daemon.c')
-rw-r--r--sharkd_daemon.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sharkd_daemon.c b/sharkd_daemon.c
index 596948b190..c356798d4b 100644
--- a/sharkd_daemon.c
+++ b/sharkd_daemon.c
@@ -28,7 +28,18 @@
#include <wsutil/socket.h>
#include <wsutil/inet_addr.h>
#include <wsutil/please_report_bug.h>
+/*
+ * If we have getopt_long() in the system library, include <getopt.h>.
+ * Otherwise, we're using our own getopt_long() (either because the
+ * system has getopt() but not getopt_long(), as with some UN*Xes,
+ * or because it doesn't even have getopt(), as with Windows), so
+ * include our getopt_long()'s header.
+ */
+#ifdef HAVE_GETOPT_LONG
+#include <getopt.h>
+#else
#include <wsutil/wsgetopt.h>
+#endif
#ifndef _WIN32
#include <sys/un.h>