From 221edee07c2cc3c2f8f366215fb5c38b5c9fd27d Mon Sep 17 00:00:00 2001 From: DJ Lucas Date: Tue, 5 Dec 2017 22:40:57 -0600 Subject: [PATCH] Forgot print_usage() on invalid option. --- examplar.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examplar.cpp b/examplar.cpp index 58d7ba8..654eb01 100644 --- a/examplar.cpp +++ b/examplar.cpp @@ -32,8 +32,7 @@ void print_usage() { - printf("examplar [ -h/--help ] [ -v/--verbose ] [ -c/--config CONFIG_PATH ]\n\n"); - exit(0); + printf("examplar [ -h | --help ] [ -v | --verbose ] [ -c | --config CONFIG_PATH ]\n\n"); } int main( int argc, char * argv[] ) @@ -78,6 +77,9 @@ int main( int argc, char * argv[] ) case 'c': config_path = std::string(optarg); break; + case '?': + print_usage(); + exit(1); default: break; } @@ -86,6 +88,7 @@ int main( int argc, char * argv[] ) if ( show_help == true ) { print_usage(); + exit(0); } setlogmask( LOG_UPTO( LOG_INFO ) );