aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Tüxen <tuexen@fh-muenster.de>2011-05-21 13:22:38 +0000
committerMichael Tüxen <tuexen@fh-muenster.de>2011-05-21 13:22:38 +0000
commitc6c2577bbc97388be260fb677db3f730e1b372c3 (patch)
tree8bc7aec6442df25a052234489841db151914f247
parent9be282951b1490764fc226296edb65c37ee1ea05 (diff)
Fix the capturing from the GUI. Honor the iface variable.
The next step is to retire the iface variable and use the ifaces array only. This should simplify things and fix the cases, where you start wireshark with command line arguments and also use the GUI. svn path=/trunk/; revision=37342
-rw-r--r--capture_sync.c7
-rw-r--r--gtk/main.c4
-rw-r--r--gtk/main_statusbar.c32
3 files changed, 24 insertions, 19 deletions
diff --git a/capture_sync.c b/capture_sync.c
index 191cd198fd..dec9522fe1 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -361,6 +361,7 @@ sync_pipe_start(capture_options *capture_opts) {
int i;
guint j;
interface_options interface_opts;
+ gboolean no_ifaces;
if (capture_opts->ifaces->len > 1)
capture_opts->use_pcapng = TRUE;
@@ -426,6 +427,7 @@ sync_pipe_start(capture_options *capture_opts) {
argv = sync_pipe_add_arg(argv, &argc, sautostop_duration);
}
if (capture_opts->ifaces->len == 0) {
+ no_ifaces = TRUE;
interface_opts.name = g_strdup(capture_opts->iface);
if (capture_opts->iface_descr) {
interface_opts.descr = g_strdup(capture_opts->iface_descr);
@@ -472,6 +474,8 @@ sync_pipe_start(capture_options *capture_opts) {
interface_opts.sampling_param = capture_opts->sampling_param;
#endif
g_array_append_val(capture_opts->ifaces, interface_opts);
+ } else {
+ no_ifaces = FALSE;
}
for (j = 0; j < capture_opts->ifaces->len; j++) {
@@ -541,6 +545,9 @@ sync_pipe_start(capture_options *capture_opts) {
}
#endif
}
+ if (no_ifaces) {
+ capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, 0);
+ }
/* dumpcap should be running in capture child mode (hidden feature) */
#ifndef DEBUG_CHILD
diff --git a/gtk/main.c b/gtk/main.c
index 5fa49b3a94..d1ea6a0e85 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1522,9 +1522,7 @@ main_capture_set_main_window_title(capture_options *capture_opts)
GString *title = g_string_new("");
g_string_append(title, "Capturing ");
- if (capture_opts->ifaces->len > 0) {
- g_string_append_printf(title, "from %s ", cf_get_tempfile_source(capture_opts->cf));
- }
+ g_string_append_printf(title, "from %s ", cf_get_tempfile_source(capture_opts->cf));
set_main_window_name(title->str);
g_string_free(title, TRUE);
}
diff --git a/gtk/main_statusbar.c b/gtk/main_statusbar.c
index ffaea3a928..29f184d926 100644
--- a/gtk/main_statusbar.c
+++ b/gtk/main_statusbar.c
@@ -695,6 +695,7 @@ statusbar_get_interface_names(capture_options *capture_opts)
GString *interface_names;
interface_names = g_string_new("");
+
if (capture_opts->ifaces->len == 0) {
g_string_append_printf(interface_names, "%s", get_iface_description(capture_opts));
#ifdef _WIN32
@@ -711,27 +712,26 @@ statusbar_get_interface_names(capture_options *capture_opts)
} else {
g_string_append_printf(interface_names, "%u interfaces", capture_opts->ifaces->len);
}
+ if (strlen (interface_names->str) > 0) {
+ g_string_append(interface_names, ":");
+ }
+ g_string_append(interface_names, " ");
return (interface_names);
}
static void
statusbar_capture_update_started_cb(capture_options *capture_opts)
{
+ GString *interface_names;
+
statusbar_pop_file_msg();
welcome_header_pop_msg();
- if (capture_opts->ifaces->len > 0) {
- GString *interface_names;
-
- interface_names = statusbar_get_interface_names(capture_opts);
- statusbar_push_file_msg(" %s: <live capture in progress> to file: %s",
- interface_names->str,
- (capture_opts->save_file) ? capture_opts->save_file : "");
- g_string_free(interface_names, TRUE);
- } else {
- statusbar_push_file_msg(" <live capture in progress> to file: %s",
- (capture_opts->save_file) ? capture_opts->save_file : "");
- }
+ interface_names = statusbar_get_interface_names(capture_opts);
+ statusbar_push_file_msg("%s<live capture in progress> to file: %s",
+ interface_names->str,
+ (capture_opts->save_file) ? capture_opts->save_file : "");
+ g_string_free(interface_names, TRUE);
}
static void
@@ -746,17 +746,17 @@ statusbar_capture_update_continue_cb(capture_options *capture_opts)
interface_names = statusbar_get_interface_names(capture_opts);
if (cf->f_datalen/1024/1024 > 10) {
- statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d MB",
+ statusbar_push_file_msg("%s<live capture in progress> File: %s %" G_GINT64_MODIFIER "d MB",
interface_names->str,
capture_opts->save_file,
cf->f_datalen/1024/1024);
} else if (cf->f_datalen/1024 > 10) {
- statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d KB",
+ statusbar_push_file_msg("%s<live capture in progress> File: %s %" G_GINT64_MODIFIER "d KB",
interface_names->str,
capture_opts->save_file,
cf->f_datalen/1024);
} else {
- statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d Bytes",
+ statusbar_push_file_msg("%s<live capture in progress> File: %s %" G_GINT64_MODIFIER "d Bytes",
interface_names->str,
capture_opts->save_file,
cf->f_datalen);
@@ -783,7 +783,7 @@ statusbar_capture_fixed_started_cb(capture_options *capture_opts)
statusbar_pop_file_msg();
interface_names = statusbar_get_interface_names(capture_opts);
- statusbar_push_file_msg(" %s: <live capture in progress> to file: %s",
+ statusbar_push_file_msg("%s<live capture in progress> to file: %s",
interface_names->str,
(capture_opts->save_file) ? capture_opts->save_file : "");