Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Functions
cmdarg_err.h File Reference
#include <wireshark.h>
#include <stdarg.h>

Go to the source code of this file.

Functions

WS_DLL_PUBLIC void cmdarg_err_init (void(*err)(const char *, va_list), void(*err_cont)(const char *, va_list))
 Initialize error reporting callbacks for command-line argument handling.
 
WS_DLL_PUBLIC void vcmdarg_err (const char *fmt, va_list ap) G_GNUC_PRINTF(1
 Report an error in command-line arguments.
 
WS_DLL_PUBLIC void WS_DLL_PUBLIC void cmdarg_err (const char *fmt,...) G_GNUC_PRINTF(1
 Report an error in command-line arguments.
 
WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void cmdarg_err_cont (const char *fmt,...) G_GNUC_PRINTF(1
 Report additional information for an error in command-line arguments.
 
WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void stderr_cmdarg_err (const char *msg_format, va_list ap)
 Print a formatted command-line error message to standard error.
 
WS_DLL_PUBLIC void stderr_cmdarg_err_cont (const char *msg_format, va_list ap)
 Print additional context for a command-line error to standard error.
 

Detailed Description

Declarations of routines to report command-line argument errors.

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Function Documentation

◆ cmdarg_err()

WS_DLL_PUBLIC void WS_DLL_PUBLIC void cmdarg_err ( const char *  fmt,
  ... 
)

Report an error in command-line arguments.

Calls the err function passed to cmdarg_err_init to report an report an error in command-line arguments.

Parameters
fmtFormat string describing the error.
...Arguments for the format string.

◆ cmdarg_err_cont()

WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void cmdarg_err_cont ( const char *  fmt,
  ... 
)

Report additional information for an error in command-line arguments.

Calls the print_err_cont function passed to cmdarg_err_init to report an report an error in command-line arguments.

Parameters
fmtFormat string describing the error.
...Arguments for the format string.

◆ cmdarg_err_init()

WS_DLL_PUBLIC void cmdarg_err_init ( void(*)(const char *, va_list)  err,
void(*)(const char *, va_list)  err_cont 
)

Initialize error reporting callbacks for command-line argument handling.

Sets the functions used to report fatal and non-fatal error messages during command-line argument parsing or validation. The err function is called for fatal errors, while err_cont is used for warnings or recoverable issues.

Both callbacks accept a printf-style format string and a va_list of arguments. This allows flexible integration with custom logging or UI systems.

Parameters
errCallback for fatal error messages.
err_contCallback for non-fatal error messages.

◆ stderr_cmdarg_err()

WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void stderr_cmdarg_err ( const char *  msg_format,
va_list  ap 
)

Print a formatted command-line error message to standard error.

Outputs an error message using the provided va_list arguments, typically during command-line parsing or validation. This variant writes directly to stderr, bypassing any custom logging or UI systems.

Parameters
msg_formatFormat string (printf-style).
apva_list containing arguments for the format string.

◆ stderr_cmdarg_err_cont()

WS_DLL_PUBLIC void stderr_cmdarg_err_cont ( const char *  msg_format,
va_list  ap 
)

Print additional context for a command-line error to standard error.

Appends a follow-up message to a previously reported error, using the provided va_list arguments. This is useful for extending diagnostics across multiple lines or clarifying the source of a failure.

Parameters
msg_formatFormat string (printf-style).
apva_list containing arguments for the format string.

◆ vcmdarg_err()

WS_DLL_PUBLIC void vcmdarg_err ( const char *  fmt,
va_list  ap 
)

Report an error in command-line arguments.

Calls the err function passed to cmdarg_err_init to report an report an error in command-line arguments.

Parameters
fmtFormat string describing the error.
apva_list containing arguments for the format string.