aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/capture_prefs.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-06-28 01:59:46 +0000
committerGuy Harris <guy@alum.mit.edu>2002-06-28 01:59:46 +0000
commite65f81cc5c4ac7ab2ecff4d2d144cc691424473a (patch)
treedf2b6021efb6a44b1be8693daf30f9f7607c1d94 /gtk/capture_prefs.c
parentd24a5fd6c93e108b6e0a82fd5bbb0f7956342669 (diff)
Trim leading and trailing white space from the capture device in the
preference setting, and, if it's empty, treat that as an indication that the user doesn't want to wire in a default device, and just wants the first device in the list chosen. svn path=/trunk/; revision=5773
Diffstat (limited to 'gtk/capture_prefs.c')
-rw-r--r--gtk/capture_prefs.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gtk/capture_prefs.c b/gtk/capture_prefs.c
index cae9e16596..00742c5c06 100644
--- a/gtk/capture_prefs.c
+++ b/gtk/capture_prefs.c
@@ -1,7 +1,7 @@
/* capture_prefs.c
* Dialog box for capture preferences
*
- * $Id: capture_prefs.c,v 1.11 2002/05/24 07:05:44 guy Exp $
+ * $Id: capture_prefs.c,v 1.12 2002/06/28 01:59:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -138,8 +138,17 @@ capture_prefs_fetch(GtkWidget *w)
prefs.capture_device = NULL;
}
- if_text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(if_cb)->entry));
- prefs.capture_device = g_strdup(if_text);
+ if_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(if_cb)->entry)));
+ /* Strip out white space */
+ g_strstrip(if_text);
+ /* If there was nothing but white space, treat that as an
+ indication that the user doesn't want to wire in a default
+ device, and just wants the first device in the list chosen. */
+ if (*if_text == '\0') {
+ g_free(if_text);
+ if_text = NULL;
+ }
+ prefs.capture_device = if_text;
prefs.capture_prom_mode = GTK_TOGGLE_BUTTON (promisc_cb)->active;