aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capinfos.c6
-rw-r--r--capture_opts.h26
-rw-r--r--captype.c6
-rw-r--r--dumpcap.c12
-rw-r--r--editcap.c20
-rw-r--r--extcap/androiddump.c24
-rw-r--r--extcap/ciscodump.c6
-rw-r--r--extcap/dpauxmon.c8
-rw-r--r--extcap/etl.c8
-rw-r--r--extcap/etwdump.c12
-rw-r--r--extcap/extcap-base.h20
-rw-r--r--extcap/randpktdump.c18
-rw-r--r--extcap/sdjournal.c8
-rw-r--r--extcap/ssh-base.h20
-rw-r--r--extcap/sshdump.c12
-rw-r--r--extcap/udpdump.c10
-rw-r--r--mergecap.c6
-rw-r--r--randpkt.c4
-rw-r--r--rawshark.c6
-rw-r--r--reordercap.c6
-rw-r--r--sharkd_daemon.c10
-rw-r--r--text2pcap.c6
-rw-r--r--tfshark.c6
-rw-r--r--tshark.c20
-rw-r--r--ui/commandline.c16
-rw-r--r--ui/dissect_opts.h8
-rw-r--r--wiretap/pcapng.c6
-rw-r--r--writecap/pcapio.c66
-rw-r--r--wsutil/test_wsutil.c8
-rw-r--r--wsutil/ws_getopt.c12
-rw-r--r--wsutil/ws_getopt.h12
31 files changed, 204 insertions, 204 deletions
diff --git a/capinfos.c b/capinfos.c
index 43cbcf6480..49be19de54 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -1547,9 +1547,9 @@ main(int argc, char *argv[])
gboolean need_separator = FALSE;
int opt;
int overall_error_status = EXIT_SUCCESS;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
{0, 0, 0, 0 }
};
diff --git a/capture_opts.h b/capture_opts.h
index 84379403f3..dd5850d2c7 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -59,7 +59,7 @@ extern "C" {
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
#define LONGOPT_BUFFER_SIZE \
- {"buffer-size", required_argument, NULL, 'B'},
+ {"buffer-size", ws_required_argument, NULL, 'B'},
#define OPTSTRING_B "B:"
#else
#define LONGOPT_BUFFER_SIZE
@@ -67,7 +67,7 @@ extern "C" {
#endif
#ifdef HAVE_PCAP_CREATE
-#define LONGOPT_MONITOR_MODE {"monitor-mode", no_argument, NULL, 'I'},
+#define LONGOPT_MONITOR_MODE {"monitor-mode", ws_no_argument, NULL, 'I'},
#define OPTSTRING_I "I"
#else
#define LONGOPT_MONITOR_MODE
@@ -75,19 +75,19 @@ extern "C" {
#endif
#define LONGOPT_CAPTURE_COMMON \
- {"autostop", required_argument, NULL, 'a'}, \
- {"ring-buffer", required_argument, NULL, 'b'}, \
+ {"autostop", ws_required_argument, NULL, 'a'}, \
+ {"ring-buffer", ws_required_argument, NULL, 'b'}, \
LONGOPT_BUFFER_SIZE \
- {"list-interfaces", no_argument, NULL, 'D'}, \
- {"interface", required_argument, NULL, 'i'}, \
+ {"list-interfaces", ws_no_argument, NULL, 'D'}, \
+ {"interface", ws_required_argument, NULL, 'i'}, \
LONGOPT_MONITOR_MODE \
- {"list-data-link-types", no_argument, NULL, 'L'}, \
- {"no-promiscuous-mode", no_argument, NULL, 'p'}, \
- {"snapshot-length", required_argument, NULL, 's'}, \
- {"linktype", required_argument, NULL, 'y'}, \
- {"list-time-stamp-types", no_argument, NULL, LONGOPT_LIST_TSTAMP_TYPES}, \
- {"time-stamp-type", required_argument, NULL, LONGOPT_SET_TSTAMP_TYPE}, \
- {"compress-type", required_argument, NULL, LONGOPT_COMPRESS_TYPE},
+ {"list-data-link-types", ws_no_argument, NULL, 'L'}, \
+ {"no-promiscuous-mode", ws_no_argument, NULL, 'p'}, \
+ {"snapshot-length", ws_required_argument, NULL, 's'}, \
+ {"linktype", ws_required_argument, NULL, 'y'}, \
+ {"list-time-stamp-types", ws_no_argument, NULL, LONGOPT_LIST_TSTAMP_TYPES}, \
+ {"time-stamp-type", ws_required_argument, NULL, LONGOPT_SET_TSTAMP_TYPE}, \
+ {"compress-type", ws_required_argument, NULL, LONGOPT_COMPRESS_TYPE},
#define OPTSTRING_CAPTURE_COMMON \
diff --git a/captype.c b/captype.c
index 150ee87a01..320a6be686 100644
--- a/captype.c
+++ b/captype.c
@@ -93,9 +93,9 @@ main(int argc, char *argv[])
int i;
int opt;
int overall_error_status;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
{0, 0, 0, 0 }
};
diff --git a/dumpcap.c b/dumpcap.c
index d1093f9f70..eb6272acf2 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4822,13 +4822,13 @@ main(int argc, char *argv[])
{
char *err_msg;
int opt;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
LONGOPT_CAPTURE_COMMON
- {"ifname", required_argument, NULL, LONGOPT_IFNAME},
- {"ifdescr", required_argument, NULL, LONGOPT_IFDESCR},
- {"capture-comment", required_argument, NULL, LONGOPT_CAPTURE_COMMENT},
+ {"ifname", ws_required_argument, NULL, LONGOPT_IFNAME},
+ {"ifdescr", ws_required_argument, NULL, LONGOPT_IFDESCR},
+ {"capture-comment", ws_required_argument, NULL, LONGOPT_CAPTURE_COMMENT},
{0, 0, 0, 0 }
};
diff --git a/editcap.c b/editcap.c
index ac57d795b6..4b33dac0c0 100644
--- a/editcap.c
+++ b/editcap.c
@@ -1141,16 +1141,16 @@ main(int argc, char *argv[])
#define LONGOPT_CAPTURE_COMMENT LONGOPT_BASE_APPLICATION+6
#define LONGOPT_DISCARD_CAPTURE_COMMENT LONGOPT_BASE_APPLICATION+7
- static const struct option long_options[] = {
- {"novlan", no_argument, NULL, LONGOPT_NO_VLAN},
- {"skip-radiotap-header", no_argument, NULL, LONGOPT_SKIP_RADIOTAP_HEADER},
- {"seed", required_argument, NULL, LONGOPT_SEED},
- {"inject-secrets", required_argument, NULL, LONGOPT_INJECT_SECRETS},
- {"discard-all-secrets", no_argument, NULL, LONGOPT_DISCARD_ALL_SECRETS},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'V'},
- {"capture-comment", required_argument, NULL, LONGOPT_CAPTURE_COMMENT},
- {"discard-capture-comment", no_argument, NULL, LONGOPT_DISCARD_CAPTURE_COMMENT},
+ static const struct ws_option long_options[] = {
+ {"novlan", ws_no_argument, NULL, LONGOPT_NO_VLAN},
+ {"skip-radiotap-header", ws_no_argument, NULL, LONGOPT_SKIP_RADIOTAP_HEADER},
+ {"seed", ws_required_argument, NULL, LONGOPT_SEED},
+ {"inject-secrets", ws_required_argument, NULL, LONGOPT_INJECT_SECRETS},
+ {"discard-all-secrets", ws_no_argument, NULL, LONGOPT_DISCARD_ALL_SECRETS},
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'V'},
+ {"capture-comment", ws_required_argument, NULL, LONGOPT_CAPTURE_COMMENT},
+ {"discard-capture-comment", ws_no_argument, NULL, LONGOPT_DISCARD_CAPTURE_COMMENT},
{0, 0, 0, 0 }
};
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index 4720223273..1767ef0ee6 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -198,19 +198,19 @@ enum {
OPT_CONFIG_BT_LOCAL_TCP_PORT
};
-static struct option longopts[] = {
+static struct ws_option longopts[] = {
EXTCAP_BASE_OPTIONS,
- { "help", no_argument, NULL, OPT_HELP},
- { "version", no_argument, NULL, OPT_VERSION},
- { "adb-server-ip", required_argument, NULL, OPT_CONFIG_ADB_SERVER_IP},
- { "adb-server-tcp-port", required_argument, NULL, OPT_CONFIG_ADB_SERVER_TCP_PORT},
- { "logcat-text", optional_argument, NULL, OPT_CONFIG_LOGCAT_TEXT},
- { "logcat-ignore-log-buffer", optional_argument, NULL, OPT_CONFIG_LOGCAT_IGNORE_LOG_BUFFER},
- { "logcat-custom-options", required_argument, NULL, OPT_CONFIG_LOGCAT_CUSTOM_OPTIONS},
- { "bt-server-tcp-port", required_argument, NULL, OPT_CONFIG_BT_SERVER_TCP_PORT},
- { "bt-forward-socket", required_argument, NULL, OPT_CONFIG_BT_FORWARD_SOCKET},
- { "bt-local-ip", required_argument, NULL, OPT_CONFIG_BT_LOCAL_IP},
- { "bt-local-tcp-port", required_argument, NULL, OPT_CONFIG_BT_LOCAL_TCP_PORT},
+ { "help", ws_no_argument, NULL, OPT_HELP},
+ { "version", ws_no_argument, NULL, OPT_VERSION},
+ { "adb-server-ip", ws_required_argument, NULL, OPT_CONFIG_ADB_SERVER_IP},
+ { "adb-server-tcp-port", ws_required_argument, NULL, OPT_CONFIG_ADB_SERVER_TCP_PORT},
+ { "logcat-text", ws_optional_argument, NULL, OPT_CONFIG_LOGCAT_TEXT},
+ { "logcat-ignore-log-buffer", ws_optional_argument, NULL, OPT_CONFIG_LOGCAT_IGNORE_LOG_BUFFER},
+ { "logcat-custom-options", ws_required_argument, NULL, OPT_CONFIG_LOGCAT_CUSTOM_OPTIONS},
+ { "bt-server-tcp-port", ws_required_argument, NULL, OPT_CONFIG_BT_SERVER_TCP_PORT},
+ { "bt-forward-socket", ws_required_argument, NULL, OPT_CONFIG_BT_FORWARD_SOCKET},
+ { "bt-local-ip", ws_required_argument, NULL, OPT_CONFIG_BT_LOCAL_IP},
+ { "bt-local-tcp-port", ws_required_argument, NULL, OPT_CONFIG_BT_LOCAL_TCP_PORT},
{ 0, 0, 0, 0 }
};
diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c
index d9cdb46218..0fa67f60e7 100644
--- a/extcap/ciscodump.c
+++ b/extcap/ciscodump.c
@@ -76,10 +76,10 @@ enum {
OPT_REMOTE_COUNT
};
-static struct option longopts[] = {
+static struct ws_option longopts[] = {
EXTCAP_BASE_OPTIONS,
- { "help", no_argument, NULL, OPT_HELP},
- { "version", no_argument, NULL, OPT_VERSION},
+ { "help", ws_no_argument, NULL, OPT_HELP},
+ { "version", ws_no_argument, NULL, OPT_VERSION},
SSH_BASE_OPTIONS,
{ 0, 0, 0, 0}
};
diff --git a/extcap/dpauxmon.c b/extcap/dpauxmon.c
index d668f20633..97c6a50431 100644
--- a/extcap/dpauxmon.c
+++ b/extcap/dpauxmon.c
@@ -51,13 +51,13 @@ enum {
OPT_INTERFACE_ID,
};
-static struct option longopts[] = {
+static struct ws_option longopts[] = {
EXTCAP_BASE_OPTIONS,
/* Generic application options */
- { "help", no_argument, NULL, OPT_HELP},
- { "version", no_argument, NULL, OPT_VERSION},
+ { "help", ws_no_argument, NULL, OPT_HELP},
+ { "version", ws_no_argument, NULL, OPT_VERSION},
/* Interfaces options */
- { "interface_id", required_argument, NULL, OPT_INTERFACE_ID},
+ { "interface_id", ws_required_argument, NULL, OPT_INTERFACE_ID},
{ 0, 0, 0, 0 }
};
diff --git a/extcap/etl.c b/extcap/etl.c
index a4ff72e152..9a74e3ccc9 100644
--- a/extcap/etl.c
+++ b/extcap/etl.c
@@ -54,10 +54,10 @@ enum {
OPT_LEVEL,
};
-static struct option longopts[] = {
- { "p", required_argument, NULL, OPT_PROVIDER},
- { "k", required_argument, NULL, OPT_KEYWORD},
- { "l", required_argument, NULL, OPT_LEVEL},
+static struct ws_option longopts[] = {
+ { "p", ws_required_argument, NULL, OPT_PROVIDER},
+ { "k", ws_required_argument, NULL, OPT_KEYWORD},
+ { "l", ws_required_argument, NULL, OPT_LEVEL},
{ 0, 0, 0, 0 }
};
diff --git a/extcap/etwdump.c b/extcap/etwdump.c
index 29e7499841..8ec5407141 100644
--- a/extcap/etwdump.c
+++ b/extcap/etwdump.c
@@ -41,13 +41,13 @@ enum {
OPT_PARAMS
};
-static struct option longopts[] = {
+static struct ws_option longopts[] = {
EXTCAP_BASE_OPTIONS,
- { "help", no_argument, NULL, OPT_HELP},
- { "version", no_argument, NULL, OPT_VERSION},
- { "iue", optional_argument, NULL, OPT_INCLUDE_UNDECIDABLE_EVENT},
- { "etlfile", required_argument, NULL, OPT_ETLFILE},
- { "params", required_argument, NULL, OPT_PARAMS},
+ { "help", ws_no_argument, NULL, OPT_HELP},
+ { "version", ws_no_argument, NULL, OPT_VERSION},
+ { "iue", ws_optional_argument, NULL, OPT_INCLUDE_UNDECIDABLE_EVENT},
+ { "etlfile", ws_required_argument, NULL, OPT_ETLFILE},
+ { "params", ws_required_argument, NULL, OPT_PARAMS},
{ 0, 0, 0, 0 }
};
diff --git a/extcap/extcap-base.h b/extcap/extcap-base.h
index bb7911ca38..2bc74f656a 100644
--- a/extcap/extcap-base.h
+++ b/extcap/extcap-base.h
@@ -40,16 +40,16 @@
#define EXTCAP_BASE_OPTIONS \
- { "extcap-interfaces", no_argument, NULL, EXTCAP_OPT_LIST_INTERFACES}, \
- { "extcap-version", optional_argument, NULL, EXTCAP_OPT_VERSION}, \
- { "extcap-dlts", no_argument, NULL, EXTCAP_OPT_LIST_DLTS}, \
- { "extcap-interface", required_argument, NULL, EXTCAP_OPT_INTERFACE}, \
- { "extcap-config", no_argument, NULL, EXTCAP_OPT_CONFIG}, \
- { "capture", no_argument, NULL, EXTCAP_OPT_CAPTURE}, \
- { "extcap-capture-filter", required_argument, NULL, EXTCAP_OPT_CAPTURE_FILTER}, \
- { "fifo", required_argument, NULL, EXTCAP_OPT_FIFO}, \
- { "debug", no_argument, NULL, EXTCAP_OPT_DEBUG}, \
- { "debug-file", required_argument, NULL, EXTCAP_OPT_DEBUG_FILE}
+ { "extcap-interfaces", ws_no_argument, NULL, EXTCAP_OPT_LIST_INTERFACES}, \
+ { "extcap-version", ws_optional_argument, NULL, EXTCAP_OPT_VERSION}, \
+ { "extcap-dlts", ws_no_argument, NULL, EXTCAP_OPT_LIST_DLTS}, \
+ { "extcap-interface", ws_required_argument, NULL, EXTCAP_OPT_INTERFACE}, \
+ { "extcap-config", ws_no_argument, NULL, EXTCAP_OPT_CONFIG}, \
+ { "capture", ws_no_argument, NULL, EXTCAP_OPT_CAPTURE}, \
+ { "extcap-capture-filter", ws_required_argument, NULL, EXTCAP_OPT_CAPTURE_FILTER}, \
+ { "fifo", ws_required_argument, NULL, EXTCAP_OPT_FIFO}, \
+ { "debug", ws_no_argument, NULL, EXTCAP_OPT_DEBUG}, \
+ { "debug-file", ws_required_argument, NULL, EXTCAP_OPT_DEBUG_FILE}
typedef struct _extcap_parameters
{
diff --git a/extcap/randpktdump.c b/extcap/randpktdump.c
index ad74474e93..070aa53df2 100644
--- a/extcap/randpktdump.c
+++ b/extcap/randpktdump.c
@@ -42,16 +42,16 @@ enum {
OPT_TYPE
};
-static struct option longopts[] = {
+static struct ws_option longopts[] = {
EXTCAP_BASE_OPTIONS,
- { "help", no_argument, NULL, OPT_HELP},
- { "version", no_argument, NULL, OPT_VERSION},
- { "maxbytes", required_argument, NULL, OPT_MAXBYTES},
- { "count", required_argument, NULL, OPT_COUNT},
- { "delay", required_argument, NULL, OPT_DELAY},
- { "random-type", no_argument, NULL, OPT_RANDOM_TYPE},
- { "all-random", no_argument, NULL, OPT_ALL_RANDOM},
- { "type", required_argument, NULL, OPT_TYPE},
+ { "help", ws_no_argument, NULL, OPT_HELP},
+ { "version", ws_no_argument, NULL, OPT_VERSION},
+ { "maxbytes", ws_required_argument, NULL, OPT_MAXBYTES},
+ { "count", ws_required_argument, NULL, OPT_COUNT},
+ { "delay", ws_required_argument, NULL, OPT_DELAY},
+ { "random-type", ws_no_argument, NULL, OPT_RANDOM_TYPE},
+ { "all-random", ws_no_argument, NULL, OPT_ALL_RANDOM},
+ { "type", ws_required_argument, NULL, OPT_TYPE},
{ 0, 0, 0, 0 }
};
diff --git a/extcap/sdjournal.c b/extcap/sdjournal.c
index 40f9efe94b..eefd6ea7c2 100644
--- a/extcap/sdjournal.c
+++ b/extcap/sdjournal.c
@@ -50,11 +50,11 @@ enum {
OPT_START_FROM
};
-static struct option longopts[] = {
+static struct ws_option longopts[] = {
EXTCAP_BASE_OPTIONS,
- { "help", no_argument, NULL, OPT_HELP},
- { "version", no_argument, NULL, OPT_VERSION},
- { "start-from", required_argument, NULL, OPT_START_FROM},
+ { "help", ws_no_argument, NULL, OPT_HELP},
+ { "version", ws_no_argument, NULL, OPT_VERSION},
+ { "start-from", ws_required_argument, NULL, OPT_START_FROM},
{ 0, 0, 0, 0}
};
diff --git a/extcap/ssh-base.h b/extcap/ssh-base.h
index 11a6d62043..260525fd5e 100644
--- a/extcap/ssh-base.h
+++ b/extcap/ssh-base.h
@@ -28,16 +28,16 @@
#endif
#define SSH_BASE_OPTIONS \
- { "remote-host", required_argument, NULL, OPT_REMOTE_HOST}, \
- { "remote-port", required_argument, NULL, OPT_REMOTE_PORT}, \
- { "remote-username", required_argument, NULL, OPT_REMOTE_USERNAME}, \
- { "remote-password", required_argument, NULL, OPT_REMOTE_PASSWORD}, \
- { "remote-interface", required_argument, NULL, OPT_REMOTE_INTERFACE}, \
- { "remote-filter", required_argument, NULL, OPT_REMOTE_FILTER}, \
- { "remote-count", required_argument, NULL, OPT_REMOTE_COUNT}, \
- { "sshkey", required_argument, NULL, OPT_SSHKEY}, \
- { "sshkey-passphrase", required_argument, NULL, OPT_SSHKEY_PASSPHRASE}, \
- { "proxycommand", required_argument, NULL, OPT_PROXYCOMMAND}
+ { "remote-host", ws_required_argument, NULL, OPT_REMOTE_HOST}, \
+ { "remote-port", ws_required_argument, NULL, OPT_REMOTE_PORT}, \
+ { "remote-username", ws_required_argument, NULL, OPT_REMOTE_USERNAME}, \
+ { "remote-password", ws_required_argument, NULL, OPT_REMOTE_PASSWORD}, \
+ { "remote-interface", ws_required_argument, NULL, OPT_REMOTE_INTERFACE}, \
+ { "remote-filter", ws_required_argument, NULL, OPT_REMOTE_FILTER}, \
+ { "remote-count", ws_required_argument, NULL, OPT_REMOTE_COUNT}, \
+ { "sshkey", ws_required_argument, NULL, OPT_SSHKEY}, \
+ { "sshkey-passphrase", ws_required_argument, NULL, OPT_SSHKEY_PASSPHRASE}, \
+ { "proxycommand", ws_required_argument, NULL, OPT_PROXYCOMMAND}
typedef struct _ssh_params {
gchar* host;
diff --git a/extcap/sshdump.c b/extcap/sshdump.c
index 2c3bb37c7a..0247bac08f 100644
--- a/extcap/sshdump.c
+++ b/extcap/sshdump.c
@@ -61,14 +61,14 @@ enum {
OPT_REMOTE_NOPROM
};
-static struct option longopts[] = {
+static struct ws_option longopts[] = {
EXTCAP_BASE_OPTIONS,
- { "help", no_argument, NULL, OPT_HELP},
- { "version", no_argument, NULL, OPT_VERSION},
+ { "help", ws_no_argument, NULL, OPT_HELP},
+ { "version", ws_no_argument, NULL, OPT_VERSION},
SSH_BASE_OPTIONS,
- { "remote-capture-command", required_argument, NULL, OPT_REMOTE_CAPTURE_COMMAND},
- { "remote-sudo", no_argument, NULL, OPT_REMOTE_SUDO },
- { "remote-noprom", no_argument, NULL, OPT_REMOTE_NOPROM },
+ { "remote-capture-command", ws_required_argument, NULL, OPT_REMOTE_CAPTURE_COMMAND},
+ { "remote-sudo", ws_no_argument, NULL, OPT_REMOTE_SUDO },
+ { "remote-noprom", ws_no_argument, NULL, OPT_REMOTE_NOPROM },
{ 0, 0, 0, 0}
};
diff --git a/extcap/udpdump.c b/extcap/udpdump.c
index 63b29253e8..be8f044a2d 100644
--- a/extcap/udpdump.c
+++ b/extcap/udpdump.c
@@ -72,14 +72,14 @@ enum {
OPT_PAYLOAD
};
-static struct option longopts[] = {
+static struct ws_option longopts[] = {
EXTCAP_BASE_OPTIONS,
/* Generic application options */
- { "help", no_argument, NULL, OPT_HELP},
- { "version", no_argument, NULL, OPT_VERSION},
+ { "help", ws_no_argument, NULL, OPT_HELP},
+ { "version", ws_no_argument, NULL, OPT_VERSION},
/* Interfaces options */
- { "port", required_argument, NULL, OPT_PORT},
- { "payload", required_argument, NULL, OPT_PAYLOAD},
+ { "port", ws_required_argument, NULL, OPT_PORT},
+ { "payload", ws_required_argument, NULL, OPT_PAYLOAD},
{ 0, 0, 0, 0 }
};
diff --git a/mergecap.c b/mergecap.c
index 0c5b3d768d..69147bd9c3 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -198,9 +198,9 @@ main(int argc, char *argv[])
cfile_close_failure_message
};
int opt;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'V'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'V'},
{0, 0, 0, 0 }
};
gboolean do_append = FALSE;
diff --git a/randpkt.c b/randpkt.c
index dcfa1f0f73..ec02aa800c 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -122,8 +122,8 @@ main(int argc, char *argv[])
int allrandom = FALSE;
wtap_dumper *savedump;
int ret = EXIT_SUCCESS;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
{0, 0, 0, 0 }
};
diff --git a/rawshark.c b/rawshark.c
index 869f688ddb..a18bf0a536 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -406,9 +406,9 @@ main(int argc, char *argv[])
guint fc;
gboolean skip_pcap_header = FALSE;
int ret = EXIT_SUCCESS;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
{0, 0, 0, 0 }
};
diff --git a/reordercap.c b/reordercap.c
index d52f49daff..c818772d7b 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -189,9 +189,9 @@ main(int argc, char *argv[])
FrameRecord_t *prevFrame = NULL;
int opt;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
{0, 0, 0, 0 }
};
int file_count;
diff --git a/sharkd_daemon.c b/sharkd_daemon.c
index d5bda8da61..7932bb8842 100644
--- a/sharkd_daemon.c
+++ b/sharkd_daemon.c
@@ -222,11 +222,11 @@ sharkd_init(int argc, char **argv)
static const char optstring[] = OPTSTRING;
// right now we don't have any long options
- static const struct option long_options[] = {
- {"api", required_argument, NULL, 'a'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
- {"config-profile", required_argument, NULL, 'C'},
+ static const struct ws_option long_options[] = {
+ {"api", ws_required_argument, NULL, 'a'},
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
+ {"config-profile", ws_required_argument, NULL, 'C'},
{0, 0, 0, 0 }
};
diff --git a/text2pcap.c b/text2pcap.c
index 50f4b11733..95e7741ad7 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -1445,9 +1445,9 @@ parse_options (int argc, char *argv[])
{
int c;
char *p;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
{0, 0, 0, 0 }
};
struct tm *now_tm;
diff --git a/tfshark.c b/tfshark.c
index d5f717f793..93440f0ecc 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -274,9 +274,9 @@ main(int argc, char *argv[])
{
char *init_progfile_dir_error;
int opt;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
{0, 0, 0, 0 }
};
gboolean arg_error = FALSE;
diff --git a/tshark.c b/tshark.c
index 5442ca831e..fbe2229c11 100644
--- a/tshark.c
+++ b/tshark.c
@@ -688,18 +688,18 @@ main(int argc, char *argv[])
cfile_close_failure_message
};
int opt;
- static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
+ static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"version", ws_no_argument, NULL, 'v'},
LONGOPT_CAPTURE_COMMON
LONGOPT_DISSECT_COMMON
- {"print", no_argument, NULL, 'P'},
- {"export-objects", required_argument, NULL, LONGOPT_EXPORT_OBJECTS},
- {"export-tls-session-keys", required_argument, NULL, LONGOPT_EXPORT_TLS_SESSION_KEYS},
- {"color", no_argument, NULL, LONGOPT_COLOR},
- {"no-duplicate-keys", no_argument, NULL, LONGOPT_NO_DUPLICATE_KEYS},
- {"elastic-mapping-filter", required_argument, NULL, LONGOPT_ELASTIC_MAPPING_FILTER},
- {"capture-comment", required_argument, NULL, LONGOPT_CAPTURE_COMMENT},
+ {"print", ws_no_argument, NULL, 'P'},
+ {"export-objects", ws_required_argument, NULL, LONGOPT_EXPORT_OBJECTS},
+ {"export-tls-session-keys", ws_required_argument, NULL, LONGOPT_EXPORT_TLS_SESSION_KEYS},
+ {"color", ws_no_argument, NULL, LONGOPT_COLOR},
+ {"no-duplicate-keys", ws_no_argument, NULL, LONGOPT_NO_DUPLICATE_KEYS},
+ {"elastic-mapping-filter", ws_required_argument, NULL, LONGOPT_ELASTIC_MAPPING_FILTER},
+ {"capture-comment", ws_required_argument, NULL, LONGOPT_CAPTURE_COMMENT},
{0, 0, 0, 0 }
};
gboolean arg_error = FALSE;
diff --git a/ui/commandline.c b/ui/commandline.c
index e953cbb031..7ec8fa40e3 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -191,14 +191,14 @@ commandline_print_usage(gboolean for_help_option) {
#define LONGOPT_CAPTURE_COMMENT LONGOPT_BASE_GUI+2
#define OPTSTRING OPTSTRING_CAPTURE_COMMON OPTSTRING_DISSECT_COMMON "C:g:HhjJ:klm:o:P:r:R:Svw:X:Y:z:"
-static const struct option long_options[] = {
- {"help", no_argument, NULL, 'h'},
- {"read-file", required_argument, NULL, 'r' },
- {"read-filter", required_argument, NULL, 'R' },
- {"display-filter", required_argument, NULL, 'Y' },
- {"version", no_argument, NULL, 'v'},
- {"fullscreen", no_argument, NULL, LONGOPT_FULL_SCREEN },
- {"capture-comment", required_argument, NULL, LONGOPT_CAPTURE_COMMENT},
+static const struct ws_option long_options[] = {
+ {"help", ws_no_argument, NULL, 'h'},
+ {"read-file", ws_required_argument, NULL, 'r' },
+ {"read-filter", ws_required_argument, NULL, 'R' },
+ {"display-filter", ws_required_argument, NULL, 'Y' },
+ {"version", ws_no_argument, NULL, 'v'},
+ {"fullscreen", ws_no_argument, NULL, LONGOPT_FULL_SCREEN },
+ {"capture-comment", ws_required_argument, NULL, LONGOPT_CAPTURE_COMMENT},
LONGOPT_CAPTURE_COMMON
LONGOPT_DISSECT_COMMON
{0, 0, 0, 0 }
diff --git a/ui/dissect_opts.h b/ui/dissect_opts.h
index 8a1c6a64de..c795c53b9e 100644
--- a/ui/dissect_opts.h
+++ b/ui/dissect_opts.h
@@ -37,10 +37,10 @@ extern "C" {
* Options for dissecting common to all dissecting programs.
*/
#define LONGOPT_DISSECT_COMMON \
- {"disable-protocol", required_argument, NULL, LONGOPT_DISABLE_PROTOCOL }, \
- {"enable-heuristic", required_argument, NULL, LONGOPT_ENABLE_HEURISTIC }, \
- {"disable-heuristic", required_argument, NULL, LONGOPT_DISABLE_HEURISTIC }, \
- {"enable-protocol", required_argument, NULL, LONGOPT_ENABLE_PROTOCOL }, \
+ {"disable-protocol", ws_required_argument, NULL, LONGOPT_DISABLE_PROTOCOL }, \
+ {"enable-heuristic", ws_required_argument, NULL, LONGOPT_ENABLE_HEURISTIC }, \
+ {"disable-heuristic", ws_required_argument, NULL, LONGOPT_DISABLE_HEURISTIC }, \
+ {"enable-protocol", ws_required_argument, NULL, LONGOPT_ENABLE_PROTOCOL }, \
#define OPTSTRING_DISSECT_COMMON \
"d:K:nN:t:u:"
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index 93589038e8..ca499387d4 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -166,7 +166,7 @@ typedef struct pcapng_option_header_s {
/* ... Padding ... */
} pcapng_option_header_t;
-struct option {
+struct pcapng_option {
guint16 type;
guint16 value_length;
};
@@ -4907,7 +4907,7 @@ pcapng_write_sysdig_event_block(wtap_dumper *wdh, const wtap_rec *rec,
guint32 pad_len;
#if 0
gboolean have_options = FALSE;
- struct option option_hdr;
+ struct pcapng_option option_hdr;
guint32 comment_len = 0, comment_pad_len = 0;
#endif
guint32 options_total_length = 0;
@@ -5375,7 +5375,7 @@ put_nrb_options(wtap_dumper *wdh, guint8 *opt_ptr)
{
if (wdh->nrb_hdrs && wdh->nrb_hdrs->len > 0) {
wtap_block_t nrb_hdr = g_array_index(wdh->nrb_hdrs, wtap_block_t, 0);
- struct option option_hdr;
+ struct pcapng_option option_hdr;
wtap_block_foreach_option(nrb_hdr, put_nrb_option, &opt_ptr);
diff --git a/writecap/pcapio.c b/writecap/pcapio.c
index 124531de9c..4758bf41cf 100644
--- a/writecap/pcapio.c
+++ b/writecap/pcapio.c
@@ -141,7 +141,7 @@ struct epb {
};
#define ENHANCED_PACKET_BLOCK_TYPE 0x00000006
-struct option {
+struct ws_option {
guint16 type;
guint16 value_length;
};
@@ -238,7 +238,7 @@ pcapng_count_string_option(const char *option_value)
{
if ((option_value != NULL) && (strlen(option_value) > 0) && (strlen(option_value) < G_MAXUINT16)) {
/* There's a value to write; get its length */
- return (guint32)(sizeof(struct option) +
+ return (guint32)(sizeof(struct ws_option) +
(guint16)ADD_PADDING(strlen(option_value)));
}
return 0; /* nothing to write */
@@ -250,7 +250,7 @@ pcapng_write_string_option(FILE* pfile,
guint64 *bytes_written, int *err)
{
size_t option_value_length;
- struct option option;
+ struct ws_option option;
const guint32 padding = 0;
if (option_value == NULL)
@@ -261,7 +261,7 @@ pcapng_write_string_option(FILE* pfile,
option.type = option_type;
option.value_length = (guint16)option_value_length;
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)option_value, (int) option_value_length, bytes_written, err))
@@ -316,7 +316,7 @@ pcapng_write_section_header_block(FILE* pfile,
int *err)
{
struct shb shb;
- struct option option;
+ struct ws_option option;
guint32 block_total_length;
guint32 options_length;
@@ -334,7 +334,7 @@ pcapng_write_section_header_block(FILE* pfile,
options_length += pcapng_count_string_option(appname);
/* If we have options add size of end-of-options */
if (options_length != 0) {
- options_length += (guint32)sizeof(struct option);
+ options_length += (guint32)sizeof(struct ws_option);
}
block_total_length += options_length;
@@ -370,7 +370,7 @@ pcapng_write_section_header_block(FILE* pfile,
/* write end of options */
option.type = OPT_ENDOFOPT;
option.value_length = 0;
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
}
@@ -394,7 +394,7 @@ pcapng_write_interface_description_block(FILE* pfile,
int *err)
{
struct idb idb;
- struct option option;
+ struct ws_option option;
guint32 block_total_length;
guint32 options_length;
const guint32 padding = 0;
@@ -412,20 +412,20 @@ pcapng_write_interface_description_block(FILE* pfile,
/* 08 - IDB_IF_SPEED */
if (if_speed != 0) {
- options_length += (guint32)(sizeof(struct option) +
+ options_length += (guint32)(sizeof(struct ws_option) +
sizeof(guint64));
}
/* 09 - IDB_TSRESOL */
if (tsresol != 0) {
- options_length += (guint32)(sizeof(struct option) +
- sizeof(struct option));
+ options_length += (guint32)(sizeof(struct ws_option) +
+ sizeof(struct ws_option));
}
/* 11 - IDB_FILTER */
if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16)) {
/* No, this isn't a string, it has an extra type byte */
- options_length += (guint32)(sizeof(struct option) +
+ options_length += (guint32)(sizeof(struct ws_option) +
(guint16)(ADD_PADDING(strlen(filter)+ 1)));
}
@@ -437,7 +437,7 @@ pcapng_write_interface_description_block(FILE* pfile,
/* If we have options add size of end-of-options */
if (options_length != 0) {
- options_length += (guint32)sizeof(struct option);
+ options_length += (guint32)sizeof(struct ws_option);
}
block_total_length += options_length;
@@ -471,7 +471,7 @@ pcapng_write_interface_description_block(FILE* pfile,
option.type = IDB_IF_SPEED;
option.value_length = sizeof(guint64);
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&if_speed, sizeof(guint64), bytes_written, err))
@@ -483,7 +483,7 @@ pcapng_write_interface_description_block(FILE* pfile,
option.type = IDB_TSRESOL;
option.value_length = sizeof(guint8);
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&tsresol, sizeof(guint8), bytes_written, err))
@@ -499,7 +499,7 @@ pcapng_write_interface_description_block(FILE* pfile,
if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16 - 1)) {
option.type = IDB_FILTER;
option.value_length = (guint16)(strlen(filter) + 1 );
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
/* The first byte of the Option Data keeps a code of the filter used, 0 = lipbpcap filter string */
@@ -527,7 +527,7 @@ pcapng_write_interface_description_block(FILE* pfile,
/* write end of options */
option.type = OPT_ENDOFOPT;
option.value_length = 0;
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
}
@@ -550,7 +550,7 @@ pcapng_write_enhanced_packet_block(FILE* pfile,
int *err)
{
struct epb epb;
- struct option option;
+ struct ws_option option;
guint32 block_total_length;
guint64 timestamp;
guint32 options_length;
@@ -565,12 +565,12 @@ pcapng_write_enhanced_packet_block(FILE* pfile,
options_length = 0;
options_length += pcapng_count_string_option(comment);
if (flags != 0) {
- options_length += (guint32)(sizeof(struct option) +
+ options_length += (guint32)(sizeof(struct ws_option) +
sizeof(guint32));
}
/* If we have options add size of end-of-options */
if (options_length != 0) {
- options_length += (guint32)sizeof(struct option);
+ options_length += (guint32)sizeof(struct ws_option);
}
block_total_length += options_length;
timestamp = (guint64)sec * ts_mul + (guint64)usec;
@@ -613,7 +613,7 @@ pcapng_write_enhanced_packet_block(FILE* pfile,
if (flags != 0) {
option.type = EPB_FLAGS;
option.value_length = sizeof(guint32);
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&flags, sizeof(guint32), bytes_written, err))
return FALSE;
@@ -622,7 +622,7 @@ pcapng_write_enhanced_packet_block(FILE* pfile,
/* write end of options */
option.type = OPT_ENDOFOPT;
option.value_length = 0;
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
}
@@ -646,7 +646,7 @@ pcapng_write_interface_statistics_block(FILE* pfile,
#else
struct timeval now;
#endif
- struct option option;
+ struct ws_option option;
guint32 block_total_length;
guint32 options_length;
guint64 timestamp;
@@ -693,26 +693,26 @@ pcapng_write_interface_statistics_block(FILE* pfile,
block_total_length = (guint32)(sizeof(struct isb) + sizeof(guint32));
options_length = 0;
if (isb_ifrecv != G_MAXUINT64) {
- options_length += (guint32)(sizeof(struct option) +
+ options_length += (guint32)(sizeof(struct ws_option) +
sizeof(guint64));
}
if (isb_ifdrop != G_MAXUINT64) {
- options_length += (guint32)(sizeof(struct option) +
+ options_length += (guint32)(sizeof(struct ws_option) +
sizeof(guint64));
}
/* OPT_COMMENT */
options_length += pcapng_count_string_option(comment);
if (isb_starttime !=0) {
- options_length += (guint32)(sizeof(struct option) +
+ options_length += (guint32)(sizeof(struct ws_option) +
sizeof(guint64)); /* ISB_STARTTIME */
}
if (isb_endtime !=0) {
- options_length += (guint32)(sizeof(struct option) +
+ options_length += (guint32)(sizeof(struct ws_option) +
sizeof(guint64)); /* ISB_ENDTIME */
}
/* If we have options add size of end-of-options */
if (options_length != 0) {
- options_length += (guint32)sizeof(struct option);
+ options_length += (guint32)sizeof(struct ws_option);
}
block_total_length += options_length;
@@ -736,7 +736,7 @@ pcapng_write_interface_statistics_block(FILE* pfile,
option.value_length = sizeof(guint64);
high = (guint32)((isb_starttime>>32) & 0xffffffff);
low = (guint32)(isb_starttime & 0xffffffff);
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&high, sizeof(guint32), bytes_written, err))
@@ -752,7 +752,7 @@ pcapng_write_interface_statistics_block(FILE* pfile,
option.value_length = sizeof(guint64);
high = (guint32)((isb_endtime>>32) & 0xffffffff);
low = (guint32)(isb_endtime & 0xffffffff);
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&high, sizeof(guint32), bytes_written, err))
@@ -764,7 +764,7 @@ pcapng_write_interface_statistics_block(FILE* pfile,
if (isb_ifrecv != G_MAXUINT64) {
option.type = ISB_IFRECV;
option.value_length = sizeof(guint64);
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&isb_ifrecv, sizeof(guint64), bytes_written, err))
@@ -773,7 +773,7 @@ pcapng_write_interface_statistics_block(FILE* pfile,
if (isb_ifdrop != G_MAXUINT64) {
option.type = ISB_IFDROP;
option.value_length = sizeof(guint64);
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&isb_ifdrop, sizeof(guint64), bytes_written, err))
@@ -783,7 +783,7 @@ pcapng_write_interface_statistics_block(FILE* pfile,
/* write end of options */
option.type = OPT_ENDOFOPT;
option.value_length = 0;
- if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
+ if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct ws_option), bytes_written, err))
return FALSE;
}
diff --git a/wsutil/test_wsutil.c b/wsutil/test_wsutil.c
index 530b7f9db4..f4d91a751d 100644
--- a/wsutil/test_wsutil.c
+++ b/wsutil/test_wsutil.c
@@ -362,10 +362,10 @@ static void test_getopt_long_basic2(void)
char **argv;
int argc;
- struct option longopts[] = {
- { "opt1", no_argument, NULL, '1' },
- { "opt2", required_argument, NULL, '2' },
- { "opt3", required_argument, NULL, '3' },
+ struct ws_option longopts[] = {
+ { "opt1", ws_no_argument, NULL, '1' },
+ { "opt2", ws_required_argument, NULL, '2' },
+ { "opt3", ws_required_argument, NULL, '3' },
{ 0, 0, 0, 0 }
};
argv = new_argv(&argc, "/bin/ls", "--opt1", "--opt2", "arg1", "--opt3=arg2", "path", (char *)NULL);
diff --git a/wsutil/ws_getopt.c b/wsutil/ws_getopt.c
index 0363fdae5d..68a72661f9 100644
--- a/wsutil/ws_getopt.c
+++ b/wsutil/ws_getopt.c
@@ -138,9 +138,9 @@ int ws_getopt(int argc, char * const argv[], const char *optstring)
return c;
}
-static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly);
+static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct ws_option *longopts, int *idx, int longonly);
-static int __getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly)
+static int __getopt_long(int argc, char *const *argv, const char *optstring, const struct ws_option *longopts, int *idx, int longonly)
{
int ret, skipped, resumed;
if (!ws_optind || ws_optreset) {
@@ -169,7 +169,7 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con
return ret;
}
-static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly)
+static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct ws_option *longopts, int *idx, int longonly)
{
ws_optarg = 0;
if (longopts && argv[ws_optind][0] == '-' &&
@@ -223,7 +223,7 @@ static int __getopt_long_core(int argc, char *const *argv, const char *optstring
return '?';
}
ws_optarg = opt+1;
- } else if (longopts[i].has_arg == required_argument) {
+ } else if (longopts[i].has_arg == ws_required_argument) {
if (!(ws_optarg = argv[ws_optind])) {
ws_optopt = longopts[i].val;
if (colon) return ':';
@@ -258,12 +258,12 @@ static int __getopt_long_core(int argc, char *const *argv, const char *optstring
return ws_getopt(argc, argv, optstring);
}
-int ws_getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx)
+int ws_getopt_long(int argc, char *const *argv, const char *optstring, const struct ws_option *longopts, int *idx)
{
return __getopt_long(argc, argv, optstring, longopts, idx, 0);
}
-int ws_getopt_long_only(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx)
+int ws_getopt_long_only(int argc, char *const *argv, const char *optstring, const struct ws_option *longopts, int *idx)
{
return __getopt_long(argc, argv, optstring, longopts, idx, 1);
}
diff --git a/wsutil/ws_getopt.h b/wsutil/ws_getopt.h
index e0115a7df4..3f49de4415 100644
--- a/wsutil/ws_getopt.h
+++ b/wsutil/ws_getopt.h
@@ -38,19 +38,19 @@ WS_DLL_PUBLIC int ws_getopt(int, char * const [], const char *);
WS_DLL_PUBLIC char *ws_optarg;
WS_DLL_PUBLIC int ws_optind, ws_opterr, ws_optopt, ws_optpos, ws_optreset;
-struct option {
+struct ws_option {
const char *name;
int has_arg;
int *flag;
int val;
};
-WS_DLL_PUBLIC int ws_getopt_long(int, char *const *, const char *, const struct option *, int *);
-WS_DLL_PUBLIC int ws_getopt_long_only(int, char *const *, const char *, const struct option *, int *);
+WS_DLL_PUBLIC int ws_getopt_long(int, char *const *, const char *, const struct ws_option *, int *);
+WS_DLL_PUBLIC int ws_getopt_long_only(int, char *const *, const char *, const struct ws_option *, int *);
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
+#define ws_no_argument 0
+#define ws_required_argument 1
+#define ws_optional_argument 2
#ifdef __cplusplus
}