aboutsummaryrefslogtreecommitdiff
path: root/cli/cli.h
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2025-09-13 01:30:01 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2025-09-13 01:30:01 +0300
commit8c73413201a720dd24451b468155069f954dfd35 (patch)
treefd42c80b4e17bb5b69a5a2a537bf8515a33b2c95 /cli/cli.h
parent0a770cbaf0c9509415e6dabf880bf75d25a02606 (diff)
downloadc-wares-8c73413201a720dd24451b468155069f954dfd35.tar.gz
c-wares-8c73413201a720dd24451b468155069f954dfd35.zip
cli: minor bug fixes and improvments
Diffstat (limited to 'cli/cli.h')
-rw-r--r--cli/cli.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/cli/cli.h b/cli/cli.h
index 72b89c5..00848e8 100644
--- a/cli/cli.h
+++ b/cli/cli.h
@@ -431,8 +431,11 @@ static int parse_options(struct cli_ctx *ctx)
return CLI_RC_OK;
if (key[1] == '-') {
/* Everything after '--' are non-option arguments */
- if (key[2] == '\0')
+ if (key[2] == '\0') {
+ ctx->argc--;
+ ctx->argv++;
return CLI_RC_OK;
+ }
int rc = parse_long(ctx);
if (rc != CLI_RC_OK)
@@ -520,7 +523,7 @@ static int cli_run(struct cli *const cli, int argc, char *argv[])
ctx.argv++;
rc = cli_cmd_run(cli, cmd, &ctx);
- goto out;
+ return rc;
}
}
rc = CLI_RC_BAD_ARGS;