Have -X options defined before epan_init() gets called.

svn path=/trunk/; revision=20207
This commit is contained in:
Luis Ontanon 2006-12-23 03:52:38 +00:00
parent 874912824c
commit 91e2c565bd
1 changed files with 22 additions and 2 deletions

View File

@ -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