summaryrefslogtreecommitdiff
path: root/argp
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-05-21 16:03:22 +0000
committerUlrich Drepper <drepper@redhat.com>1997-05-21 16:03:22 +0000
commit9498096c93a5755cd48a72762d2b6701bd7d796e (patch)
treeab41f3aabb15b659e342ea79f795b708bd2d6d2e /argp
parent1f205a479b43e5e40672fe5b4ae8f717b28c41b1 (diff)
Update.
1997-05-21 17:50 Ulrich Drepper <drepper@cygnus.com> * elf/Makefile (dl-routines): Add dl-sysdepio. * elf/dl-support.c (_dl_sysdep_fatal): Removed. * sysdeps/generic/dl-sysdep.c: Move definition of _dl_sysdep_fatal, _dl_sysdep_error and _dl_sysdep_warning to ... * sysdeps/generic/dl-sysdepio.c: ...here. * sysdeps/mach/hurd/dl-sysdep.c: Move the functions to ... * sysdeps/mach/hurd/dl-sysdepio.c: ...here. * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Remove definition of functions. Bug reported by Marcus G. Daniels <marcus@cathcart.sysc.pdx.edu>. * db/Makefile (libdb.so): Depend on libc.so for dynamic loading and for Linux ld.so. * login/Makefile (libutil.so): Likewise. * math/Makefile (libm.so): Likewise. * md5-crypt/Makefile (libcrypt.so): Likewise. * nis/Makefile (libnss_%.so): Likewise. * resolv/Makefile (libnss_dns.so): Likewise. 1997-05-20 14:01 Miles Bader <miles@gnu.ai.mit.edu> * argp-help.c (_help): Supply STATE to argp_args_usage. (argp_args_usage): Add filtering of the args doc string. (comma): Print cluster headers for the first entry too. * argp.h (ARGP_KEY_HELP_ARGS_DOC): New macro. Patches by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>. Include <config.h> if HAVE_CONFIG_H is defined. * sunrpc/xdr_float.c: Likewise.
Diffstat (limited to 'argp')
-rw-r--r--argp/argp-help.c32
-rw-r--r--argp/argp.h1
2 files changed, 20 insertions, 13 deletions
diff --git a/argp/argp-help.c b/argp/argp-help.c
index b17c56d3a5..da6c147c30 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -973,8 +973,10 @@ comma (unsigned col, struct pentry_state *pest)
if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group)
__argp_fmtstream_putc (pest->stream, '\n');
- if (pe && cl && pe->cluster != cl && cl->header && *cl->header
- && !hol_cluster_is_child (pe->cluster, cl))
+ if (cl && cl->header && *cl->header
+ && (!pe
+ || (pe->cluster != cl
+ && !hol_cluster_is_child (pe->cluster, cl))))
/* If we're changing clusters, then this must be the start of the
ENTRY's cluster unless that is an ancestor of the previous one
(in which case we had just popped into a sub-cluster for a bit).
@@ -1305,17 +1307,19 @@ argp_args_levels (const struct argp *argp)
updated by this routine for the next call if ADVANCE is true. True is
returned as long as there are more patterns to output. */
static int
-argp_args_usage (const struct argp *argp, char **levels, int advance,
- argp_fmtstream_t stream)
+argp_args_usage (const struct argp *argp, const struct argp_state *state,
+ char **levels, int advance, argp_fmtstream_t stream)
{
char *our_level = *levels;
int multiple = 0;
const struct argp_child *child = argp->children;
- const char *doc = gettext (argp->args_doc), *nl = 0;
+ const char *tdoc = gettext (argp->args_doc), *nl = 0;
+ const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC,
+ state ? state->argp : 0, state);
- if (doc)
+ if (fdoc)
{
- nl = strchr (doc, '\n');
+ nl = strchr (fdoc, '\n');
if (nl)
/* This is a `multi-level' args doc; advance to the correct position
as determined by our state in LEVELS, and update LEVELS. */
@@ -1323,22 +1327,24 @@ argp_args_usage (const struct argp *argp, char **levels, int advance,
int i;
multiple = 1;
for (i = 0; i < *our_level; i++)
- doc = nl + 1, nl = strchr (doc, '\n');
+ fdoc = nl + 1, nl = strchr (fdoc, '\n');
(*levels)++;
}
if (! nl)
- nl = doc + strlen (doc);
+ nl = fdoc + strlen (fdoc);
/* Manually do line wrapping so that it (probably) won't get wrapped at
any embedded spaces. */
- space (stream, 1 + nl - doc);
+ space (stream, 1 + nl - fdoc);
- __argp_fmtstream_write (stream, doc, nl - doc);
+ __argp_fmtstream_write (stream, fdoc, nl - fdoc);
}
+ if (fdoc && fdoc != tdoc)
+ free ((char *)fdoc); /* Free user's modified doc string. */
if (child)
while (child->argp)
- advance = !argp_args_usage ((child++)->argp, levels, advance, stream);
+ advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream);
if (advance && multiple)
/* Need to increment our level. */
@@ -1517,7 +1523,7 @@ _help (const struct argp *argp, const struct argp_state *state, FILE *stream,
flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */
}
- more_patterns = argp_args_usage (argp, &levels, 1, fs);
+ more_patterns = argp_args_usage (argp, state, &levels, 1, fs);
__argp_fmtstream_set_wmargin (fs, old_wm);
__argp_fmtstream_set_lmargin (fs, old_lm);
diff --git a/argp/argp.h b/argp/argp.h
index 6f430d4c23..fa09e2aea6 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -242,6 +242,7 @@ struct argp
/* Explanatory note emitted when duplicate option arguments have been
suppressed. */
#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005
+#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */
/* When an argp has a non-zero CHILDREN field, it should point to a vector of
argp_child structures, each of which describes a subsidiary argp. */