From 5ab088aba9f05b480c311e94d45a88728ac9320b Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 25 Jan 2022 18:52:19 +0100 Subject: core: Fix returning of option attributes for options with args. * src/argparse.c (_gpgrt_argparse): Set attributes info flags -- GnuPG-bug-id: 5799 --- src/argparse.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/argparse.c b/src/argparse.c index a144881..cedb2f5 100644 --- a/src/argparse.c +++ b/src/argparse.c @@ -1874,6 +1874,17 @@ _gpgrt_argparse (estream_t fp, gpgrt_argparse_t *arg, gpgrt_opt_t *opts_orig) xfree (buffer); else gpgrt_annotate_leaked_object (buffer); + /* If the caller wants us to return the attributes or + * ignored options, or these flags in. */ + if ((arg->flags & ARGPARSE_FLAG_WITHATTR)) + { + if (opts[idx].ignore) + arg->r_type |= ARGPARSE_ATTR_IGNORE; + if (opts[idx].forced) + arg->r_type |= ARGPARSE_ATTR_FORCE; + if (set_ignore) + arg->r_type |= ARGPARSE_OPT_IGNORE; + } } } goto leave; -- cgit v1.2.3