diff options
author | Gerald Combs <gerald@wireshark.org> | 2011-05-24 00:07:56 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2011-05-24 00:07:56 +0000 |
commit | a24687ce8eba24d3065bd38c139abfd7720fbb7b (patch) | |
tree | df105f49b2895d2f74db9545ae4235aba0e95562 /editcap.c | |
parent | 058fc19f453cc7445a62036a29bc69938ceb1a2a (diff) | |
download | wireshark-a24687ce8eba24d3065bd38c139abfd7720fbb7b.tar.gz wireshark-a24687ce8eba24d3065bd38c139abfd7720fbb7b.tar.bz2 wireshark-a24687ce8eba24d3065bd38c139abfd7720fbb7b.zip |
Move the Windows argument list conversion code to a common routine.
svn path=/trunk/; revision=37372
Diffstat (limited to 'editcap.c')
-rw-r--r-- | editcap.c | 22 |
1 files changed, 5 insertions, 17 deletions
@@ -49,8 +49,7 @@ #endif #ifdef _WIN32 -#include <windows.h> -#include <shellapi.h> +#include <wsutil/unicode-utils.h> #include <process.h> /* getpid */ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> @@ -745,13 +744,13 @@ struct string_elem { static gint string_compare(gconstpointer a, gconstpointer b) { - return strcmp(((struct string_elem *)a)->sstr, + return strcmp(((struct string_elem *)a)->sstr, ((struct string_elem *)b)->sstr); -} +} static void string_elem_print(gpointer data, gpointer not_used _U_) -{ +{ fprintf(stderr, " %s - %s\n", ((struct string_elem *)data)->sstr, ((struct string_elem *)data)->lstr); @@ -818,11 +817,6 @@ main(int argc, char *argv[]) gchar *err_info; int opt; -#ifdef _WIN32 - LPWSTR *wc_argv; - int wc_argc; -#endif /* _WIN32 */ - char *p; unsigned int snaplen = 0; /* No limit */ int choplen = 0; /* No chop */ @@ -849,13 +843,7 @@ main(int argc, char *argv[]) #endif #ifdef _WIN32 - /* Convert our arg list to UTF-8. */ - wc_argv = CommandLineToArgvW(GetCommandLineW(), &wc_argc); - if (wc_argv && wc_argc == argc) { - for (i = 0; i < argc; i++) { - argv[i] = g_utf16_to_utf8(wc_argv[i], -1, NULL, NULL, NULL); - } - } /* XXX else bail because something is horribly, horribly wrong? */ + arg_list_utf_16to8(argc, argv); #endif /* _WIN32 */ /* |