summaryrefslogtreecommitdiff
path: root/tfshark.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 /tfshark.c
parentdd63ae2b8c889aa91577efe4621e6d0fe5432a99 (diff)
downloadwireshark-fe42762f236e23fefe47e67b6c248507d0ac5c8a.tar.gz
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 'tfshark.c')
-rw-r--r--tfshark.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/tfshark.c b/tfshark.c
index 8eb2565d83..2f71ee9256 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -59,6 +59,9 @@
#include <epan/exceptions.h>
#include <epan/epan-int.h>
#include <epan/epan.h>
+
+#include <wsutil/clopts_common.h>
+#include <wsutil/cmdarg_err.h>
#include <wsutil/crash_info.h>
#include <wsutil/privileges.h>
#include <wsutil/file_util.h>
@@ -81,8 +84,6 @@
#include <epan/print.h>
#include <epan/addr_resolv.h>
#include "ui/util.h"
-#include "clopts_common.h"
-#include "cmdarg_err.h"
#include "version_info.h"
#include "register.h"
#include <epan/epan_dissect.h>
@@ -792,6 +793,8 @@ main(int argc, char *argv[])
static const char optstring[] = OPTSTRING;
+ cmdarg_err_init(failure_message, failure_message_cont);
+
/* Assemble the compile-time version information string */
comp_info_str = g_string_new("Compiled ");
get_compiled_version_info(comp_info_str, NULL, epan_get_compiled_version_info);
@@ -2768,33 +2771,15 @@ write_failure_message(const char *filename, int err)
}
/*
- * Report an error in command-line arguments.
- */
-void
-cmdarg_err(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- failure_message(fmt, ap);
- va_end(ap);
-}
-
-/*
* Report additional information for an error in command-line arguments.
*/
-void
-cmdarg_err_cont(const char *fmt, ...)
+static void
+failure_message_cont(const char *msg_format, va_list ap)
{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
+ vfprintf(stderr, msg_format, ap);
fprintf(stderr, "\n");
- va_end(ap);
}
-
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*