Skip to content

Commit

Permalink
Exit on first invalid argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jhunkeler committed May 17, 2021
1 parent 6e313a4 commit 68bb18b
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ int main(int argc, char *argv[]) {
int do_listing;
int do_default_path;
int filter_mode;
int args_invalid;
size_t pattern_nelem;
char *pattern[CLEANPATH_PART_MAX];

Expand All @@ -127,7 +126,6 @@ int main(int argc, char *argv[]) {
pattern_nelem = 0;
memset(pattern, 0, (sizeof(pattern) / sizeof(char *)) * sizeof(char *));

args_invalid = 0;
char *args_valid[] = {
"--help", "-h",
"--version", "-V",
Expand All @@ -144,10 +142,6 @@ int main(int argc, char *argv[]) {
for (int i = 1; i < argc; i++) {
if (!is_valid_arg(args_valid, argv[i])) {
fprintf(stderr, "Unknown option: %s\n", argv[i]);
args_invalid = 1;
continue;
}
if (args_invalid) {
exit(1);
}
if (ARGM("--help") || ARGM("-h")) {
Expand Down

0 comments on commit 68bb18b

Please sign in to comment.