Forgot print_usage() on invalid option.

master
DJ Lucas 2017-12-05 22:40:57 -06:00
parent 0c70f7ee36
commit 221edee07c
1 changed files with 5 additions and 2 deletions

View File

@ -32,8 +32,7 @@
void print_usage() void print_usage()
{ {
printf("examplar [ -h/--help ] [ -v/--verbose ] [ -c/--config CONFIG_PATH ]\n\n"); printf("examplar [ -h | --help ] [ -v | --verbose ] [ -c | --config CONFIG_PATH ]\n\n");
exit(0);
} }
int main( int argc, char * argv[] ) int main( int argc, char * argv[] )
@ -78,6 +77,9 @@ int main( int argc, char * argv[] )
case 'c': case 'c':
config_path = std::string(optarg); config_path = std::string(optarg);
break; break;
case '?':
print_usage();
exit(1);
default: default:
break; break;
} }
@ -86,6 +88,7 @@ int main( int argc, char * argv[] )
if ( show_help == true ) if ( show_help == true )
{ {
print_usage(); print_usage();
exit(0);
} }
setlogmask( LOG_UPTO( LOG_INFO ) ); setlogmask( LOG_UPTO( LOG_INFO ) );