diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-06-10 19:09:49 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-06-10 19:09:49 +0000 |
commit | ef20416f669574fefe2d521d7bcce421db09201c (patch) | |
tree | d0bbb8a9187c241bbaeb602e92619a749343d108 /gtk/main.c | |
parent | 007e7ef69a66ad17d8616df82cc75e3e207a59e3 (diff) |
this is an attempt, please report problems:
after asking the devlist if this would break things and got no negative response, try to scan command line parameters twice, trying to "rewind" the getopt settings
this way, fixing #135
svn path=/trunk/; revision=14610
Diffstat (limited to 'gtk/main.c')
-rw-r--r-- | gtk/main.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gtk/main.c b/gtk/main.c index 4012665901..26c147c307 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1617,6 +1617,8 @@ main(int argc, char *argv[]) gboolean capture_child; /* True if this is the child for "-S" */ GLogLevelFlags log_flags; guint go_to_packet = 0; + gboolean show_splash = TRUE; + int optind_initial; #define OPTSTRING_INIT "a:b:c:f:g:Hhi:klLm:nN:o:pQr:R:Ss:t:w:vy:z:" @@ -1704,6 +1706,22 @@ main(int argc, char *argv[]) } #endif + /* "pre-scan" the command line parameters, if we should show a splash screen */ + /* (e.g. don't show a splash screen, if we only show the command line help) */ + optind_initial = optind; + while ((opt = getopt(argc, argv, optstring)) != -1) { + switch (opt) { + case 'h': /* help */ + case 'v': /* version */ + case 'G': /* dump various field or other infos, see handle_dashG_option() */ + show_splash = FALSE; + } + } + + /* set getopt index back to initial value, so it will start with the first command line parameter again */ + /* (XXX - this seems to be portable, but time will tell) */ + optind = optind_initial; + /* We want a splash screen only if we're not a child process */ /* We also want it only if we're not being run with "-G". XXX - we also don't want it if we're being run with @@ -1720,7 +1738,7 @@ main(int argc, char *argv[]) #ifdef HAVE_LIBPCAP && !capture_child #endif - ) { + && show_splash) { splash_win = splash_new("Loading Ethereal ..."); } |