diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2006-12-23 03:52:38 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2006-12-23 03:52:38 +0000 |
commit | 91e2c565bd49dba4d891a38041d803788d645053 (patch) | |
tree | 5f1c243bf4cfe8a6193ab65eefe068575d16b285 /tshark.c | |
parent | 874912824ce8ba4f0ff8979f5f90d86297ed1cac (diff) |
Have -X options defined before epan_init() gets called.
svn path=/trunk/; revision=20207
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -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 |