X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fopt%2Ftest%2Futils.c;h=5b054f87f315ce7524dd5c90456467c29e80e777;hp=a012d40b8e5958456a415f414a78b6514228c357;hb=9056c31b46452c92c7dd9c276664f514720a84c6;hpb=f8b1841d26dabd23c053f5fc61dbd1536cdad43c diff --git a/ccan/opt/test/utils.c b/ccan/opt/test/utils.c index a012d40b..5b054f87 100644 --- a/ccan/opt/test/utils.c +++ b/ccan/opt/test/utils.c @@ -70,33 +70,33 @@ bool parse_args(int *argc, char ***argv, ...) struct opt_table short_table[] = { /* Short opts, different args. */ - { OPT_WITHOUT_ARG(NULL, 'a', test_noarg, "a"), "Description of a" }, - { OPT_WITH_ARG(NULL, 'b', test_arg, show_arg, "b"), "Description of b" }, + OPT_WITHOUT_ARG("-a", test_noarg, "a", "Description of a"), + OPT_WITH_ARG("-b", test_arg, show_arg, "b", "Description of b"), OPT_ENDTABLE }; struct opt_table long_table[] = { /* Long opts, different args. */ - { OPT_WITHOUT_ARG("ddd", 0, test_noarg, "ddd"), "Description of ddd" }, - { OPT_WITH_ARG("eee", 0, test_arg, show_arg, "eee"), }, + OPT_WITHOUT_ARG("--ddd", test_noarg, "ddd", "Description of ddd"), + OPT_WITH_ARG("--eee ", test_arg, show_arg, "eee", ""), OPT_ENDTABLE }; struct opt_table long_and_short_table[] = { /* Short and long, different args. */ - { OPT_WITHOUT_ARG("ggg", 'g', test_noarg, "ggg"), - "Description of ggg" }, - { OPT_WITH_ARG("hhh", 'h', test_arg, NULL, "hhh"), - "Description of hhh"}, + OPT_WITHOUT_ARG("--ggg|-g", test_noarg, "ggg", "Description of ggg"), + OPT_WITH_ARG("-h|--hhh", test_arg, NULL, "hhh", "Description of hhh"), OPT_ENDTABLE }; /* Sub-table test. */ struct opt_table subtables[] = { - /* Short and long, no description */ - { OPT_WITH_ARG("jjj", 'j', test_arg, show_arg, "jjj") }, + /* Two short, and two long long, no description */ + OPT_WITH_ARG("--jjj|-j|--lll|-l", test_arg, show_arg, "jjj", ""), + /* Hidden option */ + OPT_WITH_ARG("--mmm|-m", test_arg, show_arg, "mmm", opt_hidden), OPT_SUBTABLE(short_table, NULL), OPT_SUBTABLE(long_table, "long table options"), - OPT_SUBTABLE(long_and_short_table, opt_table_hidden), + OPT_SUBTABLE(long_and_short_table, NULL), OPT_ENDTABLE };