aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2024-04-05 02:47:04 +0200
committerDavid Sterba <dsterba@suse.com>2024-04-18 19:16:15 +0200
commitf742e237e8f919ff3a3671097b3ef3f49b9b0250 (patch)
treee9e0b0dbec3e51e58e8a3375db5521515721963c
parent29b40262ba446adf8eba49b2ded66ba4539ecf53 (diff)
downloadbtrfs-progs-f742e237e8f919ff3a3671097b3ef3f49b9b0250.tar.gz
btrfs-progs: check: unify handling of unrecognized options
Use the right helper for unrecognized options so only the unknown one is printed instead of the whole help text. Also move the case to the end as is common elsewhere. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--check/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/check/main.c b/check/main.c
index 96004d37..d5c774a9 100644
--- a/check/main.c
+++ b/check/main.c
@@ -10189,9 +10189,6 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
case 'p':
g_task_ctx.progress_enabled = true;
break;
- case '?':
- case 'h':
- usage(cmd, 0);
case GETOPT_VAL_REPAIR:
printf("enabling repair mode\n");
opt_check_repair = 1;
@@ -10242,11 +10239,14 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
case GETOPT_VAL_FORCE:
force = 1;
break;
+ case '?':
+ case 'h':
+ usage_unknown_option(cmd, argv);
}
}
if (check_argc_exact(argc - optind, 1))
- usage(cmd, 1);
+ return 1;
if (g_task_ctx.progress_enabled) {
g_task_ctx.tp = TASK_NOTHING;