From 192cabe89d0baa1b2f32434c830b40e82f5a7858 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 1 Nov 2024 21:30:54 +0100 Subject: It’s -1 to subtract the ‘=’, not +1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/cli/optparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3