commit 7e2d4b7001824a5aaa36462b70f895370c210cca
parent fc1583c32f43a37ccd74cc2f3b7ee004b6967c59
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date: Sat, 30 May 2020 16:05:23 +0200
use helper macros for error/warn on arg parsing
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/lmerge.cpp b/src/lmerge.cpp
@@ -98,15 +98,14 @@ int main( int argc, char const *const *argv )
auto b_opts = std::begin( opts );
auto e_opts = std::end( opts );
- char const *arg = argv[1];
+ char const *arg = argv[1]; assert( argc > 0 );
for( int iarg = 1; iarg != argc; ++iarg, ++argv )
{
auto error = parse_cmd_opt( arg, b_opts, e_opts );
switch( error )
{
case MAX_COUNT:
- fprintf( stderr, "Warning: in arg \"%s\" => %s(error code: %04x)\n",
- arg, parse_error_msgs[error], error );
+ arg_warning( arg, error );
break;
case NONE:
case IGNORED:
@@ -117,8 +116,7 @@ int main( int argc, char const *const *argv )
case BAD_ARGS:
case BAD_SETTER:
print_help( argv[0], stderr, b_opts, e_opts );
- fprintf( stderr, "Error: in arg \"%s\" => %s(error code: 0x%04x)\n",
- arg, parse_error_msgs[error], error );
+ arg_error( arg, error );
return EXIT_FAILURE;
}
}