summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2002-05-18 02:41:46 +0000
committerGerald Combs <gerald@wireshark.org>2002-05-18 02:41:46 +0000
commit0bc4c2d329947de1add8267a2a03ef002e760785 (patch)
treee83211cde507185297678fab78231f6e21cec7b7
parent8682b694f1f6c8046e96b90015811dce3ba52ab4 (diff)
downloadwireshark-0bc4c2d329947de1add8267a2a03ef002e760785.tar.gz
In the Windows capture dialog, place the interface description before the
interface name. svn path=/trunk/; revision=5499
-rw-r--r--gtk/capture_dlg.c10
-rw-r--r--pcap-util.c73
2 files changed, 49 insertions, 34 deletions
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index c19b2107bc..6adae75f4c 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.67 2002/04/14 20:06:04 gerald Exp $
+ * $Id: capture_dlg.c,v 1.68 2002/05/18 02:41:46 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -695,7 +695,13 @@ capture_prep_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) {
if_text =
g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(if_cb)->entry)));
- if_name = strtok(if_text, " \t");
+ /* Windows combo entries have a description followed by the interface name */
+ if_name = strrchr(if_text, ' ');
+ if (if_name == NULL) {
+ if_name = if_text;
+ } else {
+ if_name++;
+ }
if (if_name == NULL) {
simple_dialog(ESD_TYPE_CRIT, NULL,
"You didn't specify an interface on which to capture packets.");
diff --git a/pcap-util.c b/pcap-util.c
index 2a46a2485a..a847c17004 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.6 2002/04/25 22:03:54 guy Exp $
+ * $Id: pcap-util.c,v 1.7 2002/05/18 02:41:45 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -391,12 +391,13 @@ search_for_if_cb(gpointer data, gpointer user_data)
search_user_data->found = TRUE;
}
#else
+#define MAX_WIN_IF_NAME_LEN 511
GList *
get_interface_list(int *err, char *err_str) {
GList *il = NULL;
wchar_t *names;
char *win95names;
- char newname[255];
+ char newname[MAX_WIN_IF_NAME_LEN + 1];
int i, j, done;
/* On Windows pcap_lookupdev is implemented by calling
@@ -432,22 +433,25 @@ get_interface_list(int *err, char *err_str) {
do
{
- j = 0;
- while (names[i] != 0)
- newname[j++] = names[i++];
- i++;
- if (names[i] == 0)
- done = 1;
-
- newname[j++] = ' ';
- newname[j++] = '(';
- while (*desc) {
- newname[j++] = *desc++;
- }
- desc++;
- newname[j++] = ')';
- newname[j++] = 0;
- il = g_list_append(il, g_strdup(newname));
+ j = 0;
+ while (*desc) {
+ if (j < MAX_WIN_IF_NAME_LEN)
+ newname[j++] = *desc++;
+ }
+ *desc++;
+ if (j < MAX_WIN_IF_NAME_LEN - 1) {
+ newname[j++] = ':';
+ newname[j++] = ' ';
+ }
+ while (names[i] != 0) {
+ if (j < MAX_WIN_IF_NAME_LEN)
+ newname[j++] = names[i++];
+ }
+ i++;
+ if (names[i] == 0)
+ done = 1;
+ newname[j] = 0;
+ il = g_list_append(il, g_strdup(newname));
} while (!done);
}
else {
@@ -461,20 +465,25 @@ get_interface_list(int *err, char *err_str) {
do
{
- j = 0;
- while (win95names[i] != 0)
- newname[j++] = win95names[i++];
- i++;
- if (win95names[i] == 0)
- done = 1;
- newname[j++] = ' ';
- newname[j++] = '(';
- while (*desc) {
- newname[j++] = *desc++;
- }
- newname[j++] = ')';
- newname[j++] = 0;
- il = g_list_append(il, g_strdup(newname));
+ j = 0;
+ while (*desc) {
+ if (j < MAX_WIN_IF_NAME_LEN)
+ newname[j++] = *desc++;
+ }
+ *desc++;
+ if (j < MAX_WIN_IF_NAME_LEN - 1) {
+ newname[j++] = ':';
+ newname[j++] = ' ';
+ }
+ while (win95names[i] != 0) {
+ if (j < MAX_WIN_IF_NAME_LEN)
+ newname[j++] = win95names[i++];
+ }
+ i++;
+ if (win95names[i] == 0)
+ done = 1;
+ newname[j] = 0;
+ il = g_list_append(il, g_strdup(newname));
} while (!done);
}
}