2.9
[glibc/nacl-glibc.git] / argp / tst-argp2.c
blob926614fbc893b4fe20c9f4adc42c1f03f8a1eb49
1 /* Copyright (C) 2007 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2007.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #include <argp.h>
22 static const struct argp_option opt1[] =
24 { "opt1", '1', "NUMBER", 0, "Option 1" },
25 { NULL, 0, NULL, 0, NULL }
28 static const struct argp_option opt2[] =
30 { "opt2", '2', "NUMBER", 0, "Option 2" },
31 { NULL, 0, NULL, 0, NULL }
34 static const struct argp_option opt3[] =
36 { "opt3", '3', "NUMBER", 0, "Option 3" },
37 { NULL, 0, NULL, 0, NULL }
40 static const struct argp_option opt4[] =
42 { "opt4", '4', "NUMBER", 0, "Option 4" },
43 { NULL, 0, NULL, 0, NULL }
46 static const struct argp_option opt5[] =
48 { "opt5", '5', "NUMBER", 0, "Option 5" },
49 { NULL, 0, NULL, 0, NULL }
52 static struct argp argp5 =
54 opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
57 static struct argp argp4 =
59 opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
62 static struct argp argp3 =
64 opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
67 static struct argp_child children2[] =
69 { &argp4, 0, "child3", 3 },
70 { &argp5, 0, "child4", 4 },
71 { NULL, 0, NULL, 0 }
74 static struct argp argp2 =
76 opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
79 static struct argp_child children1[] =
81 { &argp2, 0, "child1", 1 },
82 { &argp3, 0, "child2", 2 },
83 { NULL, 0, NULL, 0 }
86 static struct argp argp1 =
88 opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
92 static int
93 do_test (void)
95 argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
96 return 0;
100 #define TEST_FUNCTION do_test ()
101 #include "../test-skeleton.c"