]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - manual/examples/argp-ex4.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / manual / examples / argp-ex4.c
index 24dd417a81439fdabb6ea0a93ec5aa837d31f0a2..e8034afd6b3950ceafbf868bec6ebc62dfb9ebb0 100644 (file)
@@ -1,4 +1,42 @@
-/* Argp example #4 -- a program with somewhat more complicated options */
+/* Argp example #4 -- a program with somewhat more complicated options
+   Copyright (C) 1991-2015 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   as published by the Free Software Foundation; either version 2
+   of the License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, if not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* This program uses the same features as example 3, but has more
+   options, and somewhat more structure in the -help output.  It
+   also shows how you can `steal' the remainder of the input
+   arguments past a certain point, for programs that accept a
+   list of items.  It also shows the special argp KEY value
+   ARGP_KEY_NO_ARGS, which is only given if no non-option
+   arguments were supplied to the program.
+
+   For structuring the help output, two features are used,
+   *headers* which are entries in the options vector with the
+   first four fields being zero, and a two part documentation
+   string (in the variable DOC), which allows documentation both
+   before and after the options; the two parts of DOC are
+   separated by a vertical-tab character ('\v', or '\013').  By
+   convention, the documentation before the options is just a
+   short string saying what the program does, and that afterwards
+   is longer, describing the behavior in more detail.  All
+   documentation strings are automatically filled for output,
+   although newlines may be included to force a line break at a
+   particular point.  All documentation strings are also passed to
+   the `gettext' function, for possible translation into the
+   current locale.  */
 
 #include <stdlib.h>
 #include <error.h>
@@ -108,7 +146,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
 /* Our argp parser.  */
 static struct argp argp = { options, parse_opt, args_doc, doc };
 
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
 {
   int i, j;
   struct arguments arguments;