2 * Routines to report command-line argument errors.
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "cmdarg_err.h"
15 static void (*print_err
)(const char *, va_list ap
);
16 static void (*print_err_cont
)(const char *, va_list ap
);
19 * Set the reporting functions for error messages.
22 cmdarg_err_init(void (*err
)(const char *, va_list),
23 void (*err_cont
)(const char *, va_list))
26 print_err_cont
= err_cont
;
30 * Report an error in command-line arguments.
33 vcmdarg_err(const char *fmt
, va_list ap
)
39 cmdarg_err(const char *fmt
, ...)
49 * Report additional information for an error in command-line arguments.
52 cmdarg_err_cont(const char *fmt
, ...)
57 print_err_cont(fmt
, ap
);
62 * Error printing routines that report to the standard error.
65 stderr_cmdarg_err(const char *msg_format
, va_list ap
)
67 fprintf(stderr
, "%s: ", g_get_prgname());
68 vfprintf(stderr
, msg_format
, ap
);
69 fprintf(stderr
, "\n");
73 stderr_cmdarg_err_cont(const char *msg_format
, va_list ap
)
75 vfprintf(stderr
, msg_format
, ap
);
76 fprintf(stderr
, "\n");