diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/etc/t-argparse.conf | 14 | ||||
-rw-r--r-- | tests/t-argparse.c | 4 | ||||
-rw-r--r-- | tests/t-argparse.conf | 5 |
3 files changed, 17 insertions, 6 deletions
diff --git a/tests/etc/t-argparse.conf b/tests/etc/t-argparse.conf index c556466..90b9935 100644 --- a/tests/etc/t-argparse.conf +++ b/tests/etc/t-argparse.conf @@ -3,12 +3,12 @@ # Options applied to all user's config files #verbose -[echo Begin global config] - +[-echo Begin global config] +[verbose] [group :staff] # These option are applied to all users of the group staff up until # the next [group] or [user] statement. - +[-verbose] [+force] # All following option are forced and thus ignored when set in user # config files. Valid until the next [user] statement. Take care @@ -21,11 +21,14 @@ # The compliance is set immutable for these users verbose +[-force] +not-my-option + # The next shall raise an error due to the garpage at the end. #<off>[+ignore] fooo -#[+ignore-all] +[+ignore-all] # All options are ignored. @@ -55,4 +58,5 @@ my-option 42 # The default algorithm for new keys is set to this. a-long-option -[echo End global config] + +[-echo End global config] diff --git a/tests/t-argparse.c b/tests/t-argparse.c index 4719819..46b7258 100644 --- a/tests/t-argparse.c +++ b/tests/t-argparse.c @@ -74,6 +74,7 @@ main (int argc, char **argv) /* Note that on a non-utf8 terminal the ß might garble the output. */ ARGPARSE_s_n('s', "street","|Straße|set the name of the street to Straße"), ARGPARSE_o_i('m', "my-option", 0), + ARGPARSE_o_i('M', "not-my-option", 0), 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"), @@ -108,7 +109,7 @@ main (int argc, char **argv) { case ARGPARSE_CONFFILE: printf ("current conffile='%s'\n", - pargs.r.ret_str? pargs.r.ret_str: "[cmdline]"); + pargs.r_type? pargs.r.ret_str: "[cmdline]"); break; case ARGPARSE_IS_ARG : printf ("arg='%s'\n", pargs.r.ret_str); @@ -120,6 +121,7 @@ main (int argc, char **argv) case 'o': opt.outfile = pargs.r.ret_str; break; case 'c': opt.crf = pargs.r_type? pargs.r.ret_str:"a.crf"; break; case 'm': opt.myopt = pargs.r_type? pargs.r.ret_int : 1; break; + case 'M': opt.myopt = 0; break; case 500: opt.a_long_one++; break; default : pargs.err = ARGPARSE_PRINT_WARNING; any_warn = 1; break; } diff --git a/tests/t-argparse.conf b/tests/t-argparse.conf index e2c96e2..c689a63 100644 --- a/tests/t-argparse.conf +++ b/tests/t-argparse.conf @@ -1,5 +1,7 @@ # User test config file for t-argparse +[-echo begin of user config] +[+verbose] # Options applied to all user's config files echo @@ -8,4 +10,7 @@ echo my-option 4711 +not-my-option + verbose +[-echo end of user config]
\ No newline at end of file |