aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2006-12-23 03:52:38 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2006-12-23 03:52:38 +0000
commit91e2c565bd49dba4d891a38041d803788d645053 (patch)
tree5f1c243bf4cfe8a6193ab65eefe068575d16b285 /tshark.c
parent874912824ce8ba4f0ff8979f5f90d86297ed1cac (diff)
Have -X options defined before epan_init() gets called.
svn path=/trunk/; revision=20207
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/tshark.c b/tshark.c
index 066a3cb14b..cf9142372c 100644
--- a/tshark.c
+++ b/tshark.c
@@ -694,8 +694,9 @@ main(int argc, char *argv[])
char badopt;
GLogLevelFlags log_flags;
int status;
+ int optind_initial;
-#define OPTSTRING_INIT "a:b:c:d:Df:F:hi:lLnN:o:pqr:R:s:St:T:vVw:xX:y:z:"
+#define OPTSTRING_INIT "a:b:c:d:Df:F:G:hi:lLnN:o:pqr:R:s:St:T:vVw:xX:y:z:"
#ifdef HAVE_LIBPCAP
#ifdef _WIN32
#define OPTSTRING_WIN32 "B:"
@@ -722,6 +723,26 @@ main(int argc, char *argv[])
*/
get_credential_info();
+ /*
+ * in order to have the -X otps assigned before the wslua machine starts
+ * we need to getopts before epan_init() gets called
+ */
+ opterr = 0;
+ optind_initial = optind;
+
+ while ((opt = getopt(argc, argv, optstring)) != -1) {
+ switch (opt) {
+ case 'X':
+ ex_opt_add(optarg);
+ break;
+ default:
+ break;
+ }
+ }
+
+ optind = optind_initial;
+ opterr = 1;
+
/* nothing more than the standard GLib handler, but without a warning */
log_flags =
G_LOG_LEVEL_ERROR|
@@ -1059,7 +1080,6 @@ main(int argc, char *argv[])
print_hex = TRUE;
break;
case 'X':
- ex_opt_add(optarg);
break;
case 'z':
/* We won't call the init function for the stat this soon