aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2011-08-09 21:02:10 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2011-08-09 21:02:10 +0000
commitbf95c7b5e4f2d0a498fd9cee41f77262e1ddda89 (patch)
treeacde70beaac706649ef2f54d96cfddf3a7df317b
parenta60d91018f56f0beb6bfe7d797a0fea20be2339f (diff)
Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608 :
getopt() can/should normally be found in unistd.h, so: - When testing for getopt(), define that we HAVE_GETOPT instead of HAVE_GETOPT_H (to avoid confusion). - Don't attempt to include getopt.h: not all OS's have it (for example, Solaris 9 does not). - (All the places which need getopt already include unistd.h (if we have it).) If this breaks things on some OS, we might need (a real) HAVE_GETOPT_H check. svn path=/trunk/; revision=38437
-rw-r--r--capinfos.c4
-rw-r--r--configure.in2
-rw-r--r--dumpcap.c4
-rw-r--r--editcap.c4
-rw-r--r--gtk/main.c4
-rw-r--r--mergecap.c4
-rw-r--r--randpkt.c10
-rw-r--r--rawshark.c4
-rw-r--r--text2pcap.c4
-rw-r--r--tshark.c4
10 files changed, 13 insertions, 31 deletions
diff --git a/capinfos.c b/capinfos.c
index 36c1dccf09..831f48120e 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -88,9 +88,7 @@
#include <wsutil/file_util.h>
#endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif
diff --git a/configure.in b/configure.in
index 5ba873fadc..d59ff6f7d2 100644
--- a/configure.in
+++ b/configure.in
@@ -1742,7 +1742,7 @@ AC_PROG_GCC_TRADITIONAL
GETOPT_LO=""
AC_CHECK_FUNC(getopt,
[GETOPT_LO=""
- AC_DEFINE(HAVE_GETOPT_H, 1, [Define to 1 if you have the <getopt.h> header file.])
+ AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.])
],
GETOPT_LO="wsgetopt.lo"
)
diff --git a/dumpcap.c b/dumpcap.c
index 319c419507..71e3a6cec8 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -59,9 +59,7 @@
#include <signal.h>
#include <errno.h>
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif
diff --git a/editcap.c b/editcap.c
index 517e94d23b..e74946ec82 100644
--- a/editcap.c
+++ b/editcap.c
@@ -42,9 +42,7 @@
#include "wtap.h"
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif
diff --git a/gtk/main.c b/gtk/main.c
index a936329e50..5290829d40 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -45,9 +45,7 @@
#include <unistd.h>
#endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif
diff --git a/mergecap.c b/mergecap.c
index 70b4b58ff7..99a9cf26f2 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -27,9 +27,7 @@
#include <string.h>
#include "wtap.h"
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif
diff --git a/randpkt.c b/randpkt.c
index c1f58f0bf5..b6a8c86a54 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -27,16 +27,14 @@
#include "config.h"
#endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
-#include "wsutil/wsgetopt.h"
-#endif
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifndef HAVE_GETOPT
+#include "wsutil/wsgetopt.h"
+#endif
+
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
diff --git a/rawshark.c b/rawshark.c
index df30037b89..ce0e232339 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -61,9 +61,7 @@
# include <sys/stat.h>
#endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif
diff --git a/text2pcap.c b/text2pcap.c
index daf1dacece..c2d5f7f532 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -125,9 +125,7 @@
#include <errno.h>
#include <assert.h>
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif
diff --git a/tshark.c b/tshark.c
index 473a6898ec..af1b256026 100644
--- a/tshark.c
+++ b/tshark.c
@@ -51,9 +51,7 @@
# include <sys/stat.h>
#endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif