From bf95c7b5e4f2d0a498fd9cee41f77262e1ddda89 Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Tue, 9 Aug 2011 21:02:10 +0000 Subject: [PATCH] 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 --- capinfos.c | 4 +--- configure.in | 2 +- dumpcap.c | 4 +--- editcap.c | 4 +--- gtk/main.c | 4 +--- mergecap.c | 4 +--- randpkt.c | 10 ++++------ rawshark.c | 4 +--- text2pcap.c | 4 +--- tshark.c | 4 +--- 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 #endif -#ifdef HAVE_GETOPT_H -#include -#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 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 #include -#ifdef HAVE_GETOPT_H -#include -#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 -#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 #endif -#ifdef HAVE_GETOPT_H -#include -#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 #include "wtap.h" -#ifdef HAVE_GETOPT_H -#include -#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 -#else -#include "wsutil/wsgetopt.h" -#endif - #ifdef HAVE_UNISTD_H #include #endif +#ifndef HAVE_GETOPT +#include "wsutil/wsgetopt.h" +#endif + #ifdef HAVE_FCNTL_H #include #endif diff --git a/rawshark.c b/rawshark.c index df30037b89..ce0e232339 100644 --- a/rawshark.c +++ b/rawshark.c @@ -61,9 +61,7 @@ # include #endif -#ifdef HAVE_GETOPT_H -#include -#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 #include -#ifdef HAVE_GETOPT_H -#include -#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 #endif -#ifdef HAVE_GETOPT_H -#include -#else +#ifndef HAVE_GETOPT #include "wsutil/wsgetopt.h" #endif -- 2.34.1