aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pcap-util.c11
-rw-r--r--tethereal.c18
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);
}
}