aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-02-06 14:43:27 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-02-06 14:43:27 +0000
commit3a9e847e27ca953157a257c1e10b830dd880acf0 (patch)
tree9905769e7c113ca229f50f3220712223367ec3db
parentba04a65a6a2945d9394b4d2a5339a1c958d43c46 (diff)
some cleanup of the initial start sequence of Ethereal, filling in capture_opts and alike
svn path=/trunk/; revision=13317
-rw-r--r--capture.c2
-rw-r--r--gtk/main.c61
2 files changed, 33 insertions, 30 deletions
diff --git a/capture.c b/capture.c
index 8a6036d922..229ddf84c0 100644
--- a/capture.c
+++ b/capture.c
@@ -90,7 +90,7 @@ capture_opts_init(capture_options *capture_opts, void *cfile)
capture_opts->snaplen = MIN_PACKET_SIZE;
capture_opts->promisc_mode = TRUE;
capture_opts->linktype = -1; /* the default linktype */
-/* capture_opts->capture_child = FALSE;*/
+ capture_opts->capture_child = FALSE;
capture_opts->save_file = NULL;
capture_opts->save_file_fd = -1;
capture_opts->sync_mode = TRUE;
diff --git a/gtk/main.c b/gtk/main.c
index bb3c8ec5f6..93830f8eca 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1441,16 +1441,20 @@ main(int argc, char *argv[])
#endif
#ifdef HAVE_LIBPCAP
+ /* Set the initial values in the capture_opts. This might be overwritten
+ by preference settings and then again by the command line parameters. */
+ capture_opts_init(capture_opts, &cfile);
+
command_name = get_basename(ethereal_path);
/* Set "capture_child" to indicate whether this is going to be a child
process for a "-S" capture. */
capture_opts->capture_child = (strcmp(command_name, CHILD_NAME) == 0);
- /* We want a splash screen only if we're not a child process */
if (capture_opts->capture_child) {
strcat(optstring, OPTSTRING_CHILD);
- } else
+ }
#endif
- {
+
+ /* 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
"-h" or "-v", as those are options to run Ethereal and just
@@ -1462,9 +1466,12 @@ main(int argc, char *argv[])
that means we'd have to queue up, for example, "-o" options,
so that we apply them *after* reading the preferences, as
they're supposed to override saved preferences. */
- if (argc < 2 || strcmp(argv[1], "-G") != 0) {
- splash_win = splash_new("Loading Ethereal ...");
- }
+ if ((argc < 2 || strcmp(argv[1], "-G") != 0)
+#ifdef HAVE_LIBPCAP
+ && !capture_opts->capture_child
+#endif
+ ) {
+ splash_win = splash_new("Loading Ethereal ...");
}
splash_update(splash_win, "Registering dissectors ...");
@@ -1571,8 +1578,6 @@ main(int argc, char *argv[])
#endif
#ifdef HAVE_LIBPCAP
- capture_opts_init(capture_opts, &cfile);
-
/* If this is a capture child process, it should pay no attention
to the "prefs.capture_prom_mode" setting in the preferences file;
it should do what the parent process tells it to do, and if
@@ -1587,7 +1592,7 @@ main(int argc, char *argv[])
capture_opts->promisc_mode = prefs->capture_prom_mode;
capture_opts->show_info = prefs->capture_show_info;
capture_opts->sync_mode = prefs->capture_real_time;
- auto_scroll_live = prefs->capture_auto_scroll;
+ auto_scroll_live = prefs->capture_auto_scroll;
}
#endif /* HAVE_LIBPCAP */
@@ -1976,11 +1981,12 @@ main(int argc, char *argv[])
arg_error = TRUE;
}
+ if (arg_error) {
#ifndef HAVE_LIBPCAP
- if (capture_option_specified)
- fprintf(stderr, "This version of Ethereal was not built with support for capturing packets.\n");
+ if (capture_option_specified) {
+ fprintf(stderr, "This version of Ethereal was not built with support for capturing packets.\n");
+ }
#endif
- if (arg_error) {
print_usage(FALSE);
exit(1);
}
@@ -2106,6 +2112,20 @@ main(int argc, char *argv[])
exit(0);
}
+ if (capture_opts->has_snaplen) {
+ if (capture_opts->snaplen < 1)
+ capture_opts->snaplen = WTAP_MAX_PACKET_SIZE;
+ else if (capture_opts->snaplen < MIN_PACKET_SIZE)
+ capture_opts->snaplen = MIN_PACKET_SIZE;
+ }
+
+ /* Check the value range of the ringbuffer_num_files parameter */
+ if (capture_opts->ring_num_files > RINGBUFFER_MAX_NUM_FILES)
+ capture_opts->ring_num_files = RINGBUFFER_MAX_NUM_FILES;
+#if RINGBUFFER_MIN_NUM_FILES > 0
+ else if (capture_opts->num_files < RINGBUFFER_MIN_NUM_FILES)
+ capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES;
+#endif
#endif
/* Notify all registered modules that have had any of their preferences
@@ -2149,23 +2169,6 @@ main(int argc, char *argv[])
}
}
-#ifdef HAVE_LIBPCAP
- if (capture_opts->has_snaplen) {
- if (capture_opts->snaplen < 1)
- capture_opts->snaplen = WTAP_MAX_PACKET_SIZE;
- else if (capture_opts->snaplen < MIN_PACKET_SIZE)
- capture_opts->snaplen = MIN_PACKET_SIZE;
- }
-
- /* Check the value range of the ringbuffer_num_files parameter */
- if (capture_opts->ring_num_files > RINGBUFFER_MAX_NUM_FILES)
- capture_opts->ring_num_files = RINGBUFFER_MAX_NUM_FILES;
-#if RINGBUFFER_MIN_NUM_FILES > 0
- else if (capture_opts->num_files < RINGBUFFER_MIN_NUM_FILES)
- capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES;
-#endif
-#endif
-
/* read in rc file from global and personal configuration paths. */
/* XXX - is this a good idea? */
gtk_rc_parse(RC_FILE);