diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2022-10-20 14:57:42 +0200 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2022-10-20 22:28:41 +0200 |
commit | 2f387af6c0a8715e07686740bccc6e82bd601184 (patch) | |
tree | 644a1d0e9c3a099bc180b4eb7956e439627fcd79 /CommandLine.c | |
parent | d21dc622c9972f2b3b7808b6008f998c3b6c1213 (diff) |
Reject unsupported non-option command line arguments
htop help
Error: unsupported non-option ARGV-elements: help
Diffstat (limited to 'CommandLine.c')
-rw-r--r-- | CommandLine.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/CommandLine.c b/CommandLine.c index ee9047d2..5e72cbf0 100644 --- a/CommandLine.c +++ b/CommandLine.c @@ -262,6 +262,15 @@ static CommandLineStatus parseArguments(const char* program, int argc, char** ar } } } + + if (optind < argc) { + fprintf(stderr, "Error: unsupported non-option ARGV-elements:"); + while (optind < argc) + fprintf(stderr, " %s", argv[optind++]); + fprintf(stderr, "\n"); + return STATUS_ERROR_EXIT; + } + return STATUS_OK; } |