aboutsummaryrefslogtreecommitdiff
path: root/manual/examples/argp-ex4.c
diff options
context:
space:
mode:
Diffstat (limited to 'manual/examples/argp-ex4.c')
-rw-r--r--manual/examples/argp-ex4.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/manual/examples/argp-ex4.c b/manual/examples/argp-ex4.c
index 24dd417a81..fa5a8d00ec 100644
--- a/manual/examples/argp-ex4.c
+++ b/manual/examples/argp-ex4.c
@@ -1,5 +1,28 @@
/* Argp example #4 -- a program with somewhat more complicated options */
+/* 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 documenation strings are also passed to
+ the `gettext' function, for possible translation into the
+ current locale. */
+
#include <stdlib.h>
#include <error.h>
#include <argp.h>