Welcome to little lamb

Code » limb » commit 4f8818d

loadopt: Fix warning when multiple options are..

author Olivier Brunel
2023-04-02 14:32:17 UTC
committer Olivier Brunel
2023-05-20 18:06:34 UTC
parent 693a3e254454cf379bcb9271278db839fca6ddbd

loadopt: Fix warning when multiple options are..

..matching *and* a value was specified. E.g. --set=42 when there can be
--set-foo or --set-bar

src/liblimb/loadopt.h/loadopt.c +1 -1

diff --git a/src/liblimb/loadopt.h/loadopt.c b/src/liblimb/loadopt.h/loadopt.c
index ce6c143..1743d41 100644
--- a/src/liblimb/loadopt.h/loadopt.c
+++ b/src/liblimb/loadopt.h/loadopt.c
@@ -65,7 +65,7 @@ loadopt_handle(int c, const char **argv, const struct option *options,
 
     if (c == PARSEOPT_ERR_UNKNOWN && ctx->idx >= 0) {
         const char *s = argv[ctx->cur] + ctx->off;
-        size_t l = strlen(s);
+        size_t l = byte_chr(s, strlen(s), '=');
         adde("did you mean --", options[ctx->idx].longopt);
         for (int i = ctx->idx + 1; options[i].longopt; ++i)
             if (!strncmp(s, options[i].longopt, l))