From 5d48b1f124a77d8ba6805ad859f20f0136c4f977 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 8 Apr 2004 08:05:20 +0000 Subject: On Windows, when looking for the ":" that separates the interface description from the interface name, don't count ":" followed by "//", as it might be part of "rpcap://". svn path=/trunk/; revision=10562 --- gtk/capture_dlg.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'gtk/capture_dlg.c') diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c index c373199f38..3ffa683fb3 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.124 2004/03/29 22:40:57 guy Exp $ + * $Id: capture_dlg.c,v 1.125 2004/04/08 08:05:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -171,13 +171,35 @@ get_if_name(char *if_text) * return the entire string; otherwise, skip the colon and any blanks * after it, and return that string. */ - if_name = strrchr(if_text, ':'); - if (if_name == NULL) { - if_name = if_text; - } else { - if_name++; - while (*if_name == ' ') - if_name++; + if_name = if_text + strlen(if_text); + for (;;) { + if (if_name == if_text) { + /* We're at the beginning of the string; return it. */ + break; + } + if_name--; + if (*if_name == ':') { + /* + * We've found a colon. + * Unfortunately, a colon is used in the string "rpcap://", + * which is used in case of a remote capture. + * So we'll check to make sure the colon isn't followed by "//"; + * it'll be followed by a blank if it separates the description + * and the interface name. (We don't wire in "rpcap", in case we + * support other protocols in the same syntax.) + */ + if (strncmp(if_name, "://", 3) != 0) { + /* + * OK, we've found a colon not followed by "//". Skip blanks + * following it. + */ + if_name++; + while (*if_name == ' ') + if_name++; + break; + } + } + /* Keep looking for a colon not followed by "//". */ } #else /* -- cgit v1.2.3