aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-03-21 06:52:13 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-03-21 06:52:13 +0000
commit278032fb2b89ffdab793f2a209fc3f041206a6a6 (patch)
tree4a4c4e3530ab1b40ddcdd864d9859693e234d671 /util.c
parent955f298dc3636294abec9981cc03b2272954e677 (diff)
Paul Welchinski's changes to, on Win32 systems:
properly handle ASCII vs. Unicode in the list of interfaces; initialize Winsock before starting a capture, so that the code in the Win32 libpcap to get the IP address and netmask by translating the host name to an IP address works. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1737 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'util.c')
-rw-r--r--util.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/util.c b/util.c
index d05cc4cd67..f49053c6bb 100644
--- a/util.c
+++ b/util.c
@@ -1,7 +1,7 @@
/* util.c
* Utility routines
*
- * $Id: util.c,v 1.38 2000/03/14 08:26:19 guy Exp $
+ * $Id: util.c,v 1.39 2000/03/21 06:51:59 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -608,25 +608,46 @@ GList *
get_interface_list(int *err, char *err_str) {
GList *il = NULL;
wchar_t *names;
+ char *win95names;
char newname[255];
int i, j, done;
names = (wchar_t *)pcap_lookupdev(err_str);
i = done = 0;
- if (names)
- do
- {
- j = 0;
- while (names[i] != 0)
- newname[j++] = names[i++];
- i++;
- if (names[i] == 0)
- done = 1;
- newname[j++] = 0;
- il = g_list_append(il, g_strdup(newname));
- } while (!done);
-
+ if (names) {
+ if (names[0]<256) {
+ /* If names[0] is less than 256 it means the first byte is 0
+ This implies that we are using unicode characters */
+ do
+ {
+ j = 0;
+ while (names[i] != 0)
+ 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 {
+ /* Otherwise we are in Windows 95/98 and using ascii(8 bit)
+ characters */
+ do
+ {
+ win95names=names;
+ j = 0;
+ while (win95names[i] != 0)
+ newname[j++] = win95names[i++];
+ i++;
+ if (win95names[i] == 0)
+ done = 1;
+ newname[j++] = 0;
+ il = g_list_append(il, g_strdup(newname));
+ } while (!done);
+ }
+ }
return(il);
}
#endif