diff options
author | Gerald Combs <gerald@wireshark.org> | 2002-06-27 22:39:16 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2002-06-27 22:39:16 +0000 |
commit | 83dc23831a86172318115027725328c34e5a1908 (patch) | |
tree | 90c491f1d8e926ce4d24eff770454df4226ba9b7 | |
parent | c2df675f3f0d43ed924ca61454651c22c3fc0bc1 (diff) |
Update tethereal to handle the "<description> : <device ID>" interface
names that are generated under Windows. Note in pcap-util.c that we
may want to separate interface device names and descriptions in the
future.
svn path=/trunk/; revision=5770
-rw-r--r-- | pcap-util.c | 11 | ||||
-rw-r--r-- | tethereal.c | 18 |
2 files changed, 23 insertions, 6 deletions
diff --git a/pcap-util.c b/pcap-util.c index a847c17004..2fad29f087 100644 --- a/pcap-util.c +++ b/pcap-util.c @@ -1,7 +1,7 @@ /* pcap-util.c * Utility routines for packet capture * - * $Id: pcap-util.c,v 1.7 2002/05/18 02:41:45 gerald Exp $ + * $Id: pcap-util.c,v 1.8 2002/06/27 22:39:16 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -390,7 +390,7 @@ search_for_if_cb(gpointer data, gpointer user_data) if (strcmp((char *)data, search_user_data->name) == 0) search_user_data->found = TRUE; } -#else +#else /* Windows */ #define MAX_WIN_IF_NAME_LEN 511 GList * get_interface_list(int *err, char *err_str) { @@ -415,7 +415,14 @@ get_interface_list(int *err, char *err_str) { * ASCII "\0"), a double UNICODE "\0", followed by the descriptions * of the adapters, in ASCII format, separated by a single ASCII * "\0" . The string is terminated by a double ASCII "\0". + * + * We prepend the device name with a description to make it easier + * for users to choose the interface they want. This requires that + * we split out the device name later on in tethereal.c and gtk/main.c. + * It might be useful to have separate structures for raw names and + * descriptions at some point. */ + names = (wchar_t *)pcap_lookupdev(err_str); i = done = 0; diff --git a/tethereal.c b/tethereal.c index 198459cda9..249fa04014 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.143 2002/06/23 21:58:02 guy Exp $ + * $Id: tethereal.c,v 1.144 2002/06/27 22:39:16 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -320,7 +320,7 @@ main(int argc, char *argv[]) gboolean capture_option_specified = FALSE; #endif int out_file_type = WTAP_FILE_PCAP; - gchar *cf_name = NULL, *rfilter = NULL; + gchar *cf_name = NULL, *rfilter = NULL, *if_text; dfilter_t *rfcode = NULL; e_prefs *prefs; char badopt; @@ -818,7 +818,12 @@ main(int argc, char *argv[]) /* No - is a default specified in the preferences file? */ if (prefs->capture_device != NULL) { /* Yes - use it. */ - cfile.iface = g_strdup(prefs->capture_device); + if_text = strrchr(prefs->capture_device, ' '); + if (if_text == NULL) { + cfile.iface = g_strdup(prefs->capture_device); + } else { + cfile.iface = g_strdup(if_text + 1); /* Skip over space */ + } } else { /* No - pick the first one from the list of interfaces. */ if_list = get_interface_list(&err, err_str); @@ -836,7 +841,12 @@ main(int argc, char *argv[]) } exit(2); } - cfile.iface = g_strdup(if_list->data); /* first interface */ + if_text = strrchr(if_list->data, ' '); /* first interface */ + if (if_text == NULL) { + cfile.iface = g_strdup(if_list->data); + } else { + cfile.iface = g_strdup(if_text + 1); /* Skip over space */ + } free_interface_list(if_list); } } |