!ENDIF
tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
- wsock32.lib user32.lib shell32.lib \
+ wsock32.lib user32.lib \
$(GLIB_LIBS) \
wsutil\libwsutil.lib \
$(GNUTLS_LIBS) \
!ENDIF
rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
- wsock32.lib user32.lib shell32.lib \
+ wsock32.lib user32.lib \
$(GLIB_LIBS) \
wsutil\libwsutil.lib \
$(GNUTLS_LIBS) \
$(GLIB_LIBS)
mergecap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
- wsock32.lib user32.lib shell32.lib \
+ wsock32.lib user32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
text2pcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
- wsock32.lib user32.lib shell32.lib \
+ wsock32.lib user32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
dumpcap_LIBS= \
- wsock32.lib user32.lib shell32.lib \
+ wsock32.lib user32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS) \
$(GTHREAD_LIBS)
!ENDIF
randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
- user32.lib shell32.lib \
+ user32.lib \
wsutil\libwsutil.lib \
$(GLIB_LIBS)
#endif
#ifdef _WIN32
-#include <shellapi.h>
+#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */
#include "svnversion.h"
int opt;
int overall_error_status;
-#ifdef _WIN32
- LPWSTR *wc_argv;
- int wc_argc, i;
-#endif /* _WIN32 */
-
int status = 0;
#ifdef HAVE_PLUGINS
char *init_progfile_dir_error;
#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 */
/*
}
return overall_error_status;
}
-
#include "pcapio.h"
#ifdef _WIN32
-#include <shellapi.h>
#include "capture-wpcap.h"
#include <wsutil/unicode-utils.h>
#endif
#ifdef _WIN32
WSADATA wsaData;
- LPWSTR *wc_argv;
- int wc_argc;
#else
struct sigaction action, oldaction;
#endif
#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 */
#ifdef _WIN32
#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>
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);
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 */
#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 */
/*
#include "../capture-wpcap.h"
#include "../capture_wpcap_packet.h"
#include <tchar.h> /* Needed for Unicode */
+#include <wsutil/unicode-utils.h>
#include <commctrl.h>
#include <shellapi.h>
#endif /* _WIN32 */
#ifdef _WIN32
WSADATA wsaData;
- LPWSTR *wc_argv;
- int wc_argc, i;
#endif /* _WIN32 */
char *rf_path;
static const char optstring[] = OPTSTRING;
#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 */
/*
#endif
#ifdef _WIN32
-#include <windows.h>
-#include <shellapi.h>
+#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */
static int
{
int opt;
-#ifdef _WIN32
- LPWSTR *wc_argv;
- int wc_argc;
-#endif /* _WIN32 */
-
gboolean do_append = FALSE;
gboolean verbose = FALSE;
int in_file_count = 0;
int count;
#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 */
/* Process the options first */
#include "wiretap/wtap.h"
#ifdef _WIN32
-#include <windows.h>
-#include <shellapi.h>
+#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */
#define array_length(x) (sizeof x / sizeof x[0])
int opt;
-#ifdef _WIN32
- LPWSTR *wc_argv;
- int wc_argc;
-#endif /* _WIN32 */
-
-
int produce_count = 1000; /* number of pkts to produce */
int produce_type = PKT_ETHERNET;
char *produce_filename = NULL;
pkt_example *example;
#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 */
while ((opt = getopt(argc, argv, "b:c:ht:")) != -1) {
#include "log.h"
#ifdef _WIN32
-#include <shellapi.h>
+#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */
/*
#ifdef _WIN32
WSADATA wsaData;
- LPWSTR *wc_argv;
- int wc_argc;
#endif /* _WIN32 */
char *gpf_path, *pf_path;
static const char optstring[] = OPTSTRING_INIT;
#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 */
/*
#include "svnversion.h"
#ifdef _WIN32
-#include <windows.h>
-#include <shellapi.h>
+#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */
/*--- Options --------------------------------------------------------------------*/
{
int c;
char *p;
-#ifdef _WIN32
- LPWSTR *wc_argv;
- int wc_argc, i;
-#endif /* _WIN32 */
#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 */
/* Scan CLI parameters */
#ifdef _WIN32
#include "capture-wpcap.h"
#include "capture_errs.h"
-#include <shellapi.h>
+#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */
#include "capture_sync.h"
#endif /* HAVE_LIBPCAP */
#ifdef _WIN32
WSADATA wsaData;
- LPWSTR *wc_argv;
- int wc_argc, i;
#endif /* _WIN32 */
char *gpf_path, *pf_path;
static const char optstring[] = OPTSTRING;
#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 */
/*
libwsutil.exp: libwsutil.dll
libwsutil.dll : $(OBJECTS) libwsutil.def ..\image\libwsutil.res
- $(link) $(dlllflags) $(conlibsdll) \
+ $(link) $(dlllflags) $(conlibsdll) shell32.lib \
$(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \
/DEF:libwsutil.def /OUT:libwsutil.dll \
/IMPLIB:libwsutil.lib \
utf_16to8
utf_8to16
utf_8to16_snprintf
+arg_list_utf_16to8
; wsgetopt.c
getopt
#include "unicode-utils.h"
+#include <shellapi.h>
+
/** @file
* Unicode utilities (internal interface)
*
return utf8buf[idx];
}
+/* Convert our argument list from UTF-16 to UTF-8. */
+void
+arg_list_utf_16to8(int argc, char *argv[]) {
+ LPWSTR *wc_argv;
+ int wc_argc, i;
+
+ /* 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? */
+}
*/
gchar * utf_16to8(const wchar_t *utf16str);
+/** Convert the program argument list from UTF-16 to UTF-8 and
+ * store it in the supplied array. This is intended to be used
+ * to normalize command line arguments at program startup.
+ *
+ * @param argc The number of arguments. You should simply pass the
+ * first argument from main().
+ * @param argv The argument values (vector). You should simply pass
+ * the second argument from main().
+ */
+void arg_list_utf_16to8(int argc, char *argv[]);
+
+
#endif /* _WIN32 */
#endif /* __UNICODEUTIL_H__ */