From fe42762f236e23fefe47e67b6c248507d0ac5c8a Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 29 Jun 2014 14:37:21 -0700 Subject: 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 Reviewed-by: Guy Harris --- tfshark.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'tfshark.c') diff --git a/tfshark.c b/tfshark.c index 8eb2565d83..2f71ee9256 100644 --- a/tfshark.c +++ b/tfshark.c @@ -59,6 +59,9 @@ #include #include #include + +#include +#include #include #include #include @@ -81,8 +84,6 @@ #include #include #include "ui/util.h" -#include "clopts_common.h" -#include "cmdarg_err.h" #include "version_info.h" #include "register.h" #include @@ -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); @@ -2767,34 +2770,16 @@ write_failure_message(const char *filename, int err) filename, g_strerror(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 * -- cgit v1.2.1