From f742e237e8f919ff3a3671097b3ef3f49b9b0250 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 5 Apr 2024 02:47:04 +0200 Subject: [PATCH] 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 --- check/main.c | 8 ++++---- 1 file 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;