tools

various tools
git clone git://deadbeef.fr/tools.git
Log | Files | Refs | README | LICENSE

commit fc1583c32f43a37ccd74cc2f3b7ee004b6967c59
parent 4c31b0f8d6392f326d9a9ebb1df1425f79261404
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date:   Sat, 30 May 2020 16:04:08 +0200

added helper macros for emiting argument parsing warn/errors

Diffstat:
Msrc/optparser.hpp | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/optparser.hpp b/src/optparser.hpp @@ -40,7 +40,7 @@ struct opt_desc_t bool (*show)( void const* val, FILE* target ); }; -//see parse_error_msgs for descriptions +//see parse_error_msgs in implementation for descriptions enum parse_error_t { NONE, @@ -54,6 +54,10 @@ enum parse_error_t }; extern char const *parse_error_msgs[]; +#define arg_warning( arg, err ) fprintf( stderr, "Warning: in arg \"%s\" => %s(error code: %04x)\n", \ + arg, parse_error_msgs[err], err ) +#define arg_error( arg, err ) fprintf( stderr, "Error: in arg \"%s\" => %s(error code: %04x)\n", \ + arg, parse_error_msgs[err], err ) // checks if a string is a command-line argument and processes it if yes // return true if the argument was ignored, false if it was successfully