aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-11-01 21:30:54 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-11-01 21:30:54 +0100
commit192cabe89d0baa1b2f32434c830b40e82f5a7858 (patch)
tree1ddb062f7d714a1db8128687c635c7ce96d5449c
parent045f4bb5b1767140c4f6cfe2d2002553925c4205 (diff)
It’s -1 to subtract the ‘=’, not +1HEADmaster
-rw-r--r--lib/cli/optparse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/cli/optparse.c b/lib/cli/optparse.c
index 25719f0..a89b652 100644
--- a/lib/cli/optparse.c
+++ b/lib/cli/optparse.c
@@ -93,7 +93,7 @@ optparse(optparser_t *st, const cli_opt_t *opts, size_t nopts)
ASSUME(opt.len > opt_no_eq.len);
st->optarg = (u8view_t){
.p = eq_p + 1,
- .len = opt.len - opt_no_eq.len + 1,
+ .len = opt.len - opt_no_eq.len - 1,
};
}
break;
@@ -167,4 +167,4 @@ error_r(optparser_t *st, const char *msg, rune ch)
utf8p() ? u8"%s — ‘%.*s’" : u8"%s -- `%.*s'",
msg, rtou8(buf, sizeof(buf), ch), buf);
return -1;
-}
+} \ No newline at end of file