aboutsummaryrefslogtreecommitdiffstats
path: root/tests/t-argparse.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-04-07 14:27:06 +0000
committerWerner Koch <[email protected]>2025-04-07 14:27:06 +0000
commit9864dd4d66342cca340f8ebe57f46b2fa274bac0 (patch)
treeace2874c1629a27b876e301adfbb80f8611b37c3 /tests/t-argparse.c
parentAdd a section mode to the name-value functions. (diff)
downloadlibgpg-error-9864dd4d66342cca340f8ebe57f46b2fa274bac0.tar.gz
libgpg-error-9864dd4d66342cca340f8ebe57f46b2fa274bac0.zip
argparse: Make getreg meta command work on Unix.
* src/argparse.c (_gpgrt_argparse_internal_s): Add fields no_registry and registry. (initialize): Init them. (emulated_registry_lookup): New. (handle_meta_getenv): Use it. * tests/etc/t-argparse.conf: Add a getreg meta command. * tests/t-argparse.c (opt): Add a disable-akr command. * tests/etc/Registry: New.
Diffstat (limited to 'tests/t-argparse.c')
-rw-r--r--tests/t-argparse.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/t-argparse.c b/tests/t-argparse.c
index 6085066..666e17d 100644
--- a/tests/t-argparse.c
+++ b/tests/t-argparse.c
@@ -40,6 +40,7 @@ static struct {
int echo;
int a_long_one;
char *street;
+ char *disable_akr;
} opt;
@@ -85,6 +86,7 @@ main (int argc, char **argv)
ARGPARSE_s_n(500, "a-long-option", 0 ),
ARGPARSE_conffile(501, "options", "|FILE|read options from FILE"),
ARGPARSE_noconffile(502, "no-options", "Ignore conf files"),
+ ARGPARSE_s_s(503, "disable-akr", "@" ),
ARGPARSE_verbatim("This epilog consists\nof only 2 lines\n"),
ARGPARSE_end()
};
@@ -93,8 +95,8 @@ main (int argc, char **argv)
| ARGPARSE_FLAG_ONEDASH
| ARGPARSE_FLAG_SYS
| ARGPARSE_FLAG_USER
- /* | ARGPARSE_FLAG_VERBOSE */
- /* | ARGPARSE_FLAG_WITHATTR */
+ | ARGPARSE_FLAG_VERBOSE
+ | ARGPARSE_FLAG_WITHATTR
) };
int i;
const char *srcdir;
@@ -146,6 +148,7 @@ main (int argc, char **argv)
case 'M': opt.myopt = 0; break;
case 's': opt.street = pargs.r.ret_str; break;
case 500: opt.a_long_one++; break;
+ case 503: opt.disable_akr = pargs.r.ret_str; break;
case 601:
case 602:
@@ -176,6 +179,8 @@ main (int argc, char **argv)
printf (" myopt=%d\n", opt.myopt );
if (opt.a_long_one)
printf (" a-long-one=%d\n", opt.a_long_one );
+ if (opt.disable_akr)
+ printf (" disable-akr=%s\n", opt.disable_akr);
if (opt.echo)
printf (" echo=%d\n", opt.echo );