aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/main.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-29 14:37:21 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-29 23:03:24 +0000
commitfe42762f236e23fefe47e67b6c248507d0ac5c8a (patch)
tree57947515414aa27789b5aea2b1e4d32c0da7e97e /ui/gtk/main.c
parentdd63ae2b8c889aa91577efe4621e6d0fe5432a99 (diff)
Move some more stuff into wsutil.
Move the routines to parse numerical command-line arguments there. Make cmdarg_err() and cmdarg_err_cont() routines in wsutil that just call routines specified by a call to cmdarg_err_init(), and have programs supply the appropriate routines to it. Change-Id: Ic24fc758c0e647f4ff49eb91673529bcb9587b01 Reviewed-on: https://code.wireshark.org/review/2704 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/gtk/main.c')
-rw-r--r--ui/gtk/main.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 5c54337cb6..ff5bf274b3 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -60,6 +60,7 @@
#include <portaudio.h>
#endif /* HAVE_LIBPORTAUDIO */
+#include <wsutil/clopts_common.h>
#include <wsutil/crash_info.h>
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
@@ -92,6 +93,7 @@
#include <epan/print.h>
#include <epan/timestamp.h>
+#include <wsutil/cmdarg_err.h>
#include <wsutil/plugins.h>
/* general (not GTK specific) */
@@ -104,8 +106,6 @@
#include "../register.h"
#include "../ringbuffer.h"
#include "ui/util.h"
-#include "../clopts_common.h"
-#include "../cmdarg_err.h"
#include "../version_info.h"
#include "../log.h"
@@ -1279,19 +1279,17 @@ show_version(void)
/*
* Report an error in command-line arguments.
* Creates a console on Windows.
+ * XXX - pop this up in a window of some sort on UNIX+X11 if the controlling
+ * terminal isn't the standard error?
*/
-void
-cmdarg_err(const char *fmt, ...)
+static void
+wireshark_cmdarg_err(const char *fmt, va_list ap)
{
- va_list ap;
-
#ifdef _WIN32
create_console();
#endif
fprintf(stderr, "wireshark: ");
- va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
- va_end(ap);
fprintf(stderr, "\n");
}
@@ -1301,18 +1299,14 @@ cmdarg_err(const char *fmt, ...)
* XXX - pop this up in a window of some sort on UNIX+X11 if the controlling
* terminal isn't the standard error?
*/
-void
-cmdarg_err_cont(const char *fmt, ...)
+static void
+wireshark_cmdarg_err_cont(const char *fmt, va_list ap)
{
- va_list ap;
-
#ifdef _WIN32
create_console();
#endif
- va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
- va_end(ap);
}
/*
@@ -2184,6 +2178,7 @@ main(int argc, char *argv[])
static const char optstring[] = OPTSTRING;
+ cmdarg_err_init(wireshark_cmdarg_err, wireshark_cmdarg_err_cont);
/* Set the C-language locale to the native environment. */
setlocale(LC_ALL, "");