aboutsummaryrefslogtreecommitdiffstats
path: root/randpkt.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-12-25 01:13:24 -0800
committerGuy Harris <guy@alum.mit.edu>2014-12-25 09:14:47 +0000
commitde8c81cd9235f97541db28b0eed6865bf3a6a291 (patch)
tree9391787816be463350dcf1e9673b31527e7a39c3 /randpkt.c
parent20503c70478e0f83b7cafebbbb759de801a1d53e (diff)
Use getopt_long().
Change-Id: I8ff74de7cedee64bc46d88f23a6d1e771d4a4a10 Reviewed-on: https://code.wireshark.org/review/6048 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'randpkt.c')
-rw-r--r--randpkt.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/randpkt.c b/randpkt.c
index 4269485..9ddfd78 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -27,6 +27,10 @@
#include <unistd.h>
#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
#ifndef HAVE_GETOPT_LONG
#include "wsutil/wsgetopt.h"
#endif
@@ -508,13 +512,17 @@ main(int argc, char **argv)
char *produce_filename = NULL;
int produce_max_bytes = 5000;
pkt_example *example;
+ static const struct option long_options[] = {
+ {(char *)"help", no_argument, NULL, 'h'},
+ {0, 0, 0, 0 }
+ };
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
create_app_running_mutex();
#endif /* _WIN32 */
- while ((opt = getopt(argc, argv, "b:c:ht:")) != -1) {
+ while ((opt = getopt_long(argc, argv, "b:c:ht:", long_options, NULL)) != -1) {
switch (opt) {
case 'b': /* max bytes */
produce_max_bytes = atoi(optarg);