| xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 1 | /* Copyright (C) 2007-2016 Free Software Foundation, Inc. | 
|  | 2 | This file is part of the GNU C Library. | 
|  | 3 | Contributed by Jakub Jelinek <jakub@redhat.com>, 2007. | 
|  | 4 |  | 
|  | 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. | 
|  | 9 |  | 
|  | 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. | 
|  | 14 |  | 
|  | 15 | You should have received a copy of the GNU Lesser General Public | 
|  | 16 | License along with the GNU C Library; if not, see | 
|  | 17 | <http://www.gnu.org/licenses/>.  */ | 
|  | 18 |  | 
|  | 19 | #include <argp.h> | 
|  | 20 |  | 
|  | 21 | static const struct argp_option opt1[] = | 
|  | 22 | { | 
|  | 23 | { "opt1", '1', "NUMBER", 0, "Option 1" }, | 
|  | 24 | { NULL, 0, NULL, 0, NULL } | 
|  | 25 | }; | 
|  | 26 |  | 
|  | 27 | static const struct argp_option opt2[] = | 
|  | 28 | { | 
|  | 29 | { "opt2", '2', "NUMBER", 0, "Option 2" }, | 
|  | 30 | { NULL, 0, NULL, 0, NULL } | 
|  | 31 | }; | 
|  | 32 |  | 
|  | 33 | static const struct argp_option opt3[] = | 
|  | 34 | { | 
|  | 35 | { "opt3", '3', "NUMBER", 0, "Option 3" }, | 
|  | 36 | { NULL, 0, NULL, 0, NULL } | 
|  | 37 | }; | 
|  | 38 |  | 
|  | 39 | static const struct argp_option opt4[] = | 
|  | 40 | { | 
|  | 41 | { "opt4", '4', "NUMBER", 0, "Option 4" }, | 
|  | 42 | { NULL, 0, NULL, 0, NULL } | 
|  | 43 | }; | 
|  | 44 |  | 
|  | 45 | static const struct argp_option opt5[] = | 
|  | 46 | { | 
|  | 47 | { "opt5", '5', "NUMBER", 0, "Option 5" }, | 
|  | 48 | { NULL, 0, NULL, 0, NULL } | 
|  | 49 | }; | 
|  | 50 |  | 
|  | 51 | static struct argp argp5 = | 
|  | 52 | { | 
|  | 53 | opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL | 
|  | 54 | }; | 
|  | 55 |  | 
|  | 56 | static struct argp argp4 = | 
|  | 57 | { | 
|  | 58 | opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL | 
|  | 59 | }; | 
|  | 60 |  | 
|  | 61 | static struct argp argp3 = | 
|  | 62 | { | 
|  | 63 | opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL | 
|  | 64 | }; | 
|  | 65 |  | 
|  | 66 | static struct argp_child children2[] = | 
|  | 67 | { | 
|  | 68 | { &argp4, 0, "child3", 3 }, | 
|  | 69 | { &argp5, 0, "child4", 4 }, | 
|  | 70 | { NULL, 0, NULL, 0 } | 
|  | 71 | }; | 
|  | 72 |  | 
|  | 73 | static struct argp argp2 = | 
|  | 74 | { | 
|  | 75 | opt2, NULL, "args doc2", "doc2", children2, NULL, NULL | 
|  | 76 | }; | 
|  | 77 |  | 
|  | 78 | static struct argp_child children1[] = | 
|  | 79 | { | 
|  | 80 | { &argp2, 0, "child1", 1 }, | 
|  | 81 | { &argp3, 0, "child2", 2 }, | 
|  | 82 | { NULL, 0, NULL, 0 } | 
|  | 83 | }; | 
|  | 84 |  | 
|  | 85 | static struct argp argp1 = | 
|  | 86 | { | 
|  | 87 | opt1, NULL, "args doc1", "doc1", children1, NULL, NULL | 
|  | 88 | }; | 
|  | 89 |  | 
|  | 90 |  | 
|  | 91 | static int | 
|  | 92 | do_test (void) | 
|  | 93 | { | 
|  | 94 | argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2"); | 
|  | 95 | return 0; | 
|  | 96 | } | 
|  | 97 |  | 
|  | 98 |  | 
|  | 99 | #define TEST_FUNCTION do_test () | 
|  | 100 | #include "../test-skeleton.c" |