1 /* Copyright (C) 2007-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18 #include <argp.h>
19
20 static const struct argp_option opt1[] =
21 {
22 { "opt1", '1', "NUMBER", 0, "Option 1" },
23 { NULL, 0, NULL, 0, NULL }
24 };
25
26 static const struct argp_option opt2[] =
27 {
28 { "opt2", '2', "NUMBER", 0, "Option 2" },
29 { NULL, 0, NULL, 0, NULL }
30 };
31
32 static const struct argp_option opt3[] =
33 {
34 { "opt3", '3', "NUMBER", 0, "Option 3" },
35 { NULL, 0, NULL, 0, NULL }
36 };
37
38 static const struct argp_option opt4[] =
39 {
40 { "opt4", '4', "NUMBER", 0, "Option 4" },
41 { NULL, 0, NULL, 0, NULL }
42 };
43
44 static const struct argp_option opt5[] =
45 {
46 { "opt5", '5', "NUMBER", 0, "Option 5" },
47 { NULL, 0, NULL, 0, NULL }
48 };
49
50 static struct argp argp5 =
51 {
52 opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
53 };
54
55 static struct argp argp4 =
56 {
57 opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
58 };
59
60 static struct argp argp3 =
61 {
62 opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
63 };
64
65 static struct argp_child children2[] =
66 {
67 { &argp4, 0, "child3", 3 },
68 { &argp5, 0, "child4", 4 },
69 { NULL, 0, NULL, 0 }
70 };
71
72 static struct argp argp2 =
73 {
74 opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
75 };
76
77 static struct argp_child children1[] =
78 {
79 { &argp2, 0, "child1", 1 },
80 { &argp3, 0, "child2", 2 },
81 { NULL, 0, NULL, 0 }
82 };
83
84 static struct argp argp1 =
85 {
86 opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
87 };
88
89
90 static int
do_test(void)91 do_test (void)
92 {
93 argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
94 return 0;
95 }
96
97
98 #define TEST_FUNCTION do_test ()
99 #include "../test-skeleton.c"
100