summaryrefslogtreecommitdiff
path: root/capture_opts.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-20 12:18:48 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-20 19:19:47 +0000
commit312ed10900df878ef8476febe72c8f1308aba106 (patch)
treec4a73afa3bd05891cad18cbde65b64d2c1ee2330 /capture_opts.h
parent6808afd0172cc1507f19ef1533f500fac4b0dce2 (diff)
downloadwireshark-312ed10900df878ef8476febe72c8f1308aba106.tar.gz
Add --help and --version long options.
Also, make the convention for long-only options be that their case-statement values start at 128, so they avoid colliding with any ASCII code points, including control characters. Make the tables of long options "static const" while we're at it, and get rid of unnecessary casts. Change-Id: I55702a85e9bc078b1cd0f2803ebb68a710405bab Reviewed-on: https://code.wireshark.org/review/2491 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'capture_opts.h')
-rw-r--r--capture_opts.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/capture_opts.h b/capture_opts.h
index f9bdf89eb6..a48635d68b 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -40,15 +40,30 @@
extern "C" {
#endif /* __cplusplus */
-/* Attention:
- for tshark, we're using a leading - in the optstring to prevent getopt()
- from permuting the argv[] entries, in this case, unknown argv[] entries
- will be returned as parameters to a dummy-option 1
- in short: we must not use 1 here */
-
-/* this does not clash with tshark's -2 option which returns '2' */
-#define LONGOPT_NUM_CAP_COMMENT 2
+/*
+ * Long options.
+ * We do not currently have long options corresponding to all short
+ * options; we should probably pick appropriate option names for them.
+ *
+ * For long options with no corresponding short options, we define values
+ * outside the range of ASCII graphic characters, make that the last
+ * component of the entry for the long option, and have a case for that
+ * option in the switch statement.
+ *
+ * NOTE:
+ * for tshark, we're using a leading - in the optstring to prevent getopt()
+ * from permuting the argv[] entries, in this case, unknown argv[] entries
+ * will be returned as parameters to a dummy-option 1.
+ * In short: we must not use 1 here, which is another reason to use
+ * values outside the range of ASCII graphic characters.
+ */
+#define LONGOPT_NUM_CAP_COMMENT 128
+/*
+ * Non-capture long-only options should start here, to avoid collision
+ * with capture options.
+ */
+#define MIN_NON_CAPTURE_LONGOPT 129
#ifdef HAVE_PCAP_REMOTE
/* Type of capture source */