From 223372f70f4d217f1b2a558e4e474b1d0eeb31c9 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 16 Sep 2021 17:08:14 -0700 Subject: vmon: exit w/error on unrecognized flag-like argument --- src/vmon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vmon.c b/src/vmon.c index bb8e3a2..5655759 100644 --- a/src/vmon.c +++ b/src/vmon.c @@ -208,7 +208,7 @@ static void print_copyright(void) "\n" "This program comes with ABSOLUTELY NO WARRANTY. This is free software, and\n" "you are welcome to redistribute it under certain conditions. For details\n" - "please see the LICENSE file included with this program." + "please see the LICENSE file included with this program.\n" ); } @@ -290,6 +290,9 @@ static int vmon_handle_argv(vmon_t *vmon, int argc, char * const argv[]) } else if (is_flag(*argv, "-h", "--help")) { print_help(); exit(EXIT_SUCCESS); + } else if ((*argv)[0] == '-') { + VWM_ERROR("Unrecognized argument: \"%s\", try --help\n", argv[0]); + exit(EXIT_FAILURE); } else { /* stop looking for more flags on first unrecognized thing, assume we're in command territory now */ break; -- cgit v1.2.3