Back to index

glibc  2.9
tst-argp2.c
Go to the documentation of this file.
00001 /* Copyright (C) 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Jakub Jelinek <jakub@redhat.com>, 2007.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #include <argp.h>
00021 
00022 static const struct argp_option opt1[] =
00023   {
00024     { "opt1", '1', "NUMBER", 0, "Option 1" },
00025     { NULL, 0, NULL, 0, NULL }
00026   };
00027 
00028 static const struct argp_option opt2[] =
00029   {
00030     { "opt2", '2', "NUMBER", 0, "Option 2" },
00031     { NULL, 0, NULL, 0, NULL }
00032   };
00033 
00034 static const struct argp_option opt3[] =
00035   {
00036     { "opt3", '3', "NUMBER", 0, "Option 3" },
00037     { NULL, 0, NULL, 0, NULL }
00038   };
00039 
00040 static const struct argp_option opt4[] =
00041   {
00042     { "opt4", '4', "NUMBER", 0, "Option 4" },
00043     { NULL, 0, NULL, 0, NULL }
00044   };
00045 
00046 static const struct argp_option opt5[] =
00047   {
00048     { "opt5", '5', "NUMBER", 0, "Option 5" },
00049     { NULL, 0, NULL, 0, NULL }
00050   };
00051 
00052 static struct argp argp5 =
00053   {
00054     opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
00055   };
00056 
00057 static struct argp argp4 =
00058   {
00059     opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
00060   };
00061 
00062 static struct argp argp3 =
00063   {
00064     opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
00065   };
00066 
00067 static struct argp_child children2[] =
00068   {
00069     { &argp4, 0, "child3", 3 },
00070     { &argp5, 0, "child4", 4 },
00071     { NULL, 0, NULL, 0 }
00072   };
00073 
00074 static struct argp argp2 =
00075   {
00076     opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
00077   };
00078 
00079 static struct argp_child children1[] =
00080   {
00081     { &argp2, 0, "child1", 1 },
00082     { &argp3, 0, "child2", 2 },
00083     { NULL, 0, NULL, 0 }
00084   };
00085 
00086 static struct argp argp1 =
00087   {
00088     opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
00089   };
00090 
00091 
00092 static int
00093 do_test (void)
00094 {
00095   argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
00096   return 0;
00097 }
00098 
00099 
00100 #define TEST_FUNCTION do_test ()
00101 #include "../test-skeleton.c"