aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/capture_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-02-23 23:13:36 +0000
committerGuy Harris <guy@alum.mit.edu>2004-02-23 23:13:36 +0000
commite0fae3ea781fee05bb11858451d8009d5e825d11 (patch)
treeae378abd32d2f95becde408731db3e0acc3ea4e0 /gtk/capture_dlg.c
parent6064ef84c20c8793f2097a5d262c7d1c1aa4a800 (diff)
Sigh. On Windows OT, device names don't have "\Device\" in front of
them, so we can't look for "\Device\" as the beginning of the interface name. Instead, on Windows, scan backwards for a colon and then skip the colon and any subsequent blanks. (I don't *think* interface names have colons in them in Windows, even on NT 5.x with the GUID crapola in the name.) svn path=/trunk/; revision=10210
Diffstat (limited to 'gtk/capture_dlg.c')
-rw-r--r--gtk/capture_dlg.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index d834974a97..d8861bbe38 100644
--- a/gtk/capture_dlg.c
+++ b/gtk/capture_dlg.c
@@ -1,7 +1,7 @@
/* capture_dlg.c
* Routines for packet capture windows
*
- * $Id: capture_dlg.c,v 1.107 2004/02/21 22:54:50 ulfl Exp $
+ * $Id: capture_dlg.c,v 1.108 2004/02/23 23:13:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -135,25 +135,43 @@ get_if_name(char *if_text)
#ifdef WIN32
/*
* We cannot assume that the interface name doesn't contain a space;
- * however, we can assume it begins with "\Device\". Search forwards
- * for a backslash; if it's followed by "Device\", stop there,
- * otherwise keep scanning until we find "\Device\". If we don't find
- * it, just return the entire string.
+ * some names on Windows OT do.
+ *
+ * We also can't assume it begins with "\Device\", either, as, on
+ * Windows OT, WinPcap doesn't put "\Device\" in front of the name.
+ *
+ * As I remember, we can't assume that the interface description
+ * doesn't contain a colon, either; I think some do.
+ *
+ * We can probably assume that the interface *name* doesn't contain
+ * a colon, however; if any interface name does contain a colon on
+ * Windows, it'll be time to just get rid of the damn interface
+ * descriptions in the drop-down list, have just the names in the
+ * drop-down list, and have a "Browse..." button to browse for interfaces,
+ * with names, descriptions, IP addresses, blah blah blah available when
+ * possible.
+ *
+ * So we search backwards for a colon. If we don't find it, just
+ * return the entire string; otherwise, skip the colon and any blanks
+ * after it, and return that string.
*/
if_name = if_text;
for (;;) {
- if_name = strchr(if_name, '\\');
+ if_name = strrchr(if_name, ':');
if (if_name == NULL)
return if_text; /* give up */
- if (strncmp(if_name + 1, "Device\\", 7) == 0)
- return if_name;
- if_name++;
+ if_name++; /* skip the colon */
+ while (*if_name == ' ')
+ if_name++;
}
#else
/*
* There's a space between the interface description and name, and
* the interface name shouldn't have a space in it (it doesn't, on
* UNIX systems); look backwards in the string for a space.
+ *
+ * (An interface name might, however, contain a colon in it, which
+ * is why we don't use the colon search on UNIX.)
*/
if_name = strrchr(if_text, ' ');
if (if_name == NULL) {