summaryrefslogtreecommitdiff
path: root/libshouldbeinlibc
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-09-02 01:46:25 +0000
committerMiles Bader <miles@gnu.org>1996-09-02 01:46:25 +0000
commit55540d41a5ae1328f2c6d81e429fc6956b2e6466 (patch)
treefeb175fcd9ce95600cbc33befe95441435131b6b /libshouldbeinlibc
parent074b2f1ee60073b31b7df51f821c709670da8e68 (diff)
(argp_help):
Print documentation only according to the ARGP_HELP_*_DOC bits in FLAGS. Possibly print bug report address if ARGP_HELP_BUG_ADDR is set. Replace FIRST by ANYTHING (sense inverted).
Diffstat (limited to 'libshouldbeinlibc')
-rw-r--r--libshouldbeinlibc/argp-help.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/libshouldbeinlibc/argp-help.c b/libshouldbeinlibc/argp-help.c
index 8bd9b13e..20a51bc0 100644
--- a/libshouldbeinlibc/argp-help.c
+++ b/libshouldbeinlibc/argp-help.c
@@ -758,7 +758,7 @@ argp_doc (const struct argp *argp, int post, int pre_blank, int first_only,
void argp_help (const struct argp *argp, FILE *stream,
unsigned flags, char *name)
{
- int first = 1;
+ int anything = 0; /* Whether we've output anything. */
struct hol *hol = 0;
if (! stream)
@@ -805,17 +805,18 @@ void argp_help (const struct argp *argp, FILE *stream,
line_wrap_set_lmargin (stream, old_lm);
putc ('\n', stream);
- first = 0;
-
- argp_doc (argp, 0, 0, 1, stream);
+ anything = 1;
}
+ if (flags & ARGP_HELP_PRE_DOC)
+ anything |= argp_doc (argp, 0, 0, 1, stream);
+
if (flags & ARGP_HELP_SEE)
{
fprintf (stream,
"Try `%s --help' or `%s --usage' for more information.\n",
name, name);
- first = 0;
+ anything = 1;
}
if (flags & ARGP_HELP_LONG)
@@ -824,14 +825,23 @@ void argp_help (const struct argp *argp, FILE *stream,
/* Print info about all the options. */
if (hol->num_entries > 0)
{
- if (! first)
+ if (anything)
putc ('\n', stream);
hol_help (hol, stream);
- first = 0;
+ anything = 1;
}
+ }
+
+ if (flags & ARGP_HELP_POST_DOC)
+ /* Print any documentation strings at the end. */
+ anything |= argp_doc (argp, 1, anything, 0, stream);
- /* Finally, print any documentation strings at the end. */
- argp_doc (argp, 1, 1, 0, stream);
+ if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address)
+ {
+ if (anything)
+ putc ('\n', stream);
+ fprintf (stream, "Report bugs to %s.\n", argp_program_bug_address);
+ anything = 1;
}
if (hol)