aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capinfos.c11
-rw-r--r--editcap.c11
-rw-r--r--mergecap.c11
-rw-r--r--reordercap.c11
-rw-r--r--text2pcap.c11
5 files changed, 50 insertions, 5 deletions
diff --git a/capinfos.c b/capinfos.c
index b01b7e2142..b8e74e91bd 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -67,6 +67,10 @@
#include <unistd.h>
#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -1111,6 +1115,11 @@ main(int argc, char *argv[])
gchar *err_info;
int opt;
int overall_error_status;
+ static const struct option long_options[] = {
+ {(char *)"help", no_argument, NULL, 'h'},
+ {(char *)"version", no_argument, NULL, 'v'},
+ {0, 0, 0, 0 }
+ };
int status = 0;
#ifdef HAVE_PLUGINS
@@ -1211,7 +1220,7 @@ main(int argc, char *argv[])
g_option_context_free(ctx);
#endif /* USE_GOPTION */
- while ((opt = getopt(argc, argv, "tEcs" FILE_HASH_OPT "dluaeyizvhxokCALTMRrSNqQBmb")) !=-1) {
+ while ((opt = getopt_long(argc, argv, "tEcs" FILE_HASH_OPT "dluaeyizvhxokCALTMRrSNqQBmb", long_options, NULL)) !=-1) {
switch (opt) {
diff --git a/editcap.c b/editcap.c
index 373aefd612..826f7c6e1b 100644
--- a/editcap.c
+++ b/editcap.c
@@ -50,6 +50,10 @@
#include <unistd.h>
#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -842,6 +846,11 @@ main(int argc, char *argv[])
int i, j, err;
gchar *err_info;
int opt;
+ static const struct option long_options[] = {
+ {(char *)"help", no_argument, NULL, 'h'},
+ {(char *)"version", no_argument, NULL, 'V'},
+ {0, 0, 0, 0 }
+ };
char *p;
guint32 snaplen = 0; /* No limit */
@@ -905,7 +914,7 @@ main(int argc, char *argv[])
#endif
/* Process the options */
- while ((opt = getopt(argc, argv, "A:B:c:C:dD:E:F:hi:Lrs:S:t:T:vVw:")) != -1) {
+ while ((opt = getopt_long(argc, argv, "A:B:c:C:dD:E:F:hi:Lrs:S:t:T:vVw:", long_options, NULL)) != -1) {
switch (opt) {
case 'A':
{
diff --git a/mergecap.c b/mergecap.c
index 85654adfbc..44c8c71b43 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -34,6 +34,10 @@
#include <unistd.h>
#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -217,6 +221,11 @@ int
main(int argc, char *argv[])
{
int opt;
+ static const struct option long_options[] = {
+ {(char *)"help", no_argument, NULL, 'h'},
+ {(char *)"version", no_argument, NULL, 'V'},
+ {0, 0, 0, 0 }
+ };
gboolean do_append = FALSE;
gboolean verbose = FALSE;
int in_file_count = 0;
@@ -245,7 +254,7 @@ main(int argc, char *argv[])
#endif /* _WIN32 */
/* Process the options first */
- while ((opt = getopt(argc, argv, "aF:hs:T:vVw:")) != -1) {
+ while ((opt = getopt_long(argc, argv, "aF:hs:T:vVw:", long_options, NULL)) != -1) {
switch (opt) {
case 'a':
diff --git a/reordercap.c b/reordercap.c
index 7b107fa329..7a9890e177 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -32,6 +32,10 @@
#include <unistd.h>
#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
#include "wtap.h"
#ifndef HAVE_GETOPT
@@ -184,12 +188,17 @@ main(int argc, char *argv[])
FrameRecord_t *prevFrame = NULL;
int opt;
+ static const struct option long_options[] = {
+ {(char *)"help", no_argument, NULL, 'h'},
+ {(char *)"version", no_argument, NULL, 'v'},
+ {0, 0, 0, 0 }
+ };
int file_count;
char *infile;
char *outfile;
/* Process the options first */
- while ((opt = getopt(argc, argv, "hnv")) != -1) {
+ while ((opt = getopt_long(argc, argv, "hnv", long_options, NULL)) != -1) {
switch (opt) {
case 'n':
write_output_regardless = FALSE;
diff --git a/text2pcap.c b/text2pcap.c
index 5c17436baa..2103c86960 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -120,6 +120,10 @@
# include <unistd.h>
#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
#include <errno.h>
#include <assert.h>
@@ -1539,6 +1543,11 @@ parse_options (int argc, char *argv[])
{
int c;
char *p;
+ static const struct option long_options[] = {
+ {(char *)"help", no_argument, NULL, 'h'},
+ {(char *)"version", no_argument, NULL, 'v'},
+ {0, 0, 0, 0 }
+ };
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
@@ -1546,7 +1555,7 @@ parse_options (int argc, char *argv[])
#endif /* _WIN32 */
/* Scan CLI parameters */
- while ((c = getopt(argc, argv, "aDdhqe:i:l:m:no:u:s:S:t:T:v4:6:")) != -1) {
+ while ((c = getopt_long(argc, argv, "aDdhqe:i:l:m:no:u:s:S:t:T:v4:6:", long_options, NULL)) != -1) {
switch (c) {
case '?': usage(TRUE); break;
case 'h': usage(FALSE); break;