From a44b384f25696e3ca00c8e9f72a8cdebd209ec31 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Wed, 18 Jun 1997 16:29:05 +0000 Subject: (argp_args_usage): Don't modify `fdoc' value since it is used to distinguish filtered strings from unmodifed strings. --- libshouldbeinlibc/argp-help.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'libshouldbeinlibc') diff --git a/libshouldbeinlibc/argp-help.c b/libshouldbeinlibc/argp-help.c index 0d944414..f0e86d9c 100644 --- a/libshouldbeinlibc/argp-help.c +++ b/libshouldbeinlibc/argp-help.c @@ -922,7 +922,7 @@ filter_doc (const char *doc, int key, const struct argp *argp, } else /* No filter. */ - return (char *)doc; + return doc; } /* Prints STR as a header line, with the margin lines set appropiately, and @@ -1319,7 +1319,8 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, if (fdoc) { - nl = strchr (fdoc, '\n'); + const char *cp = fdoc; + nl = strchr (cp, '\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. */ @@ -1327,17 +1328,17 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, int i; multiple = 1; for (i = 0; i < *our_level; i++) - fdoc = nl + 1, nl = strchr (fdoc, '\n'); + cp = nl + 1, nl = strchr (cp, '\n'); (*levels)++; } if (! nl) - nl = fdoc + strlen (fdoc); + nl = cp + strlen (cp); /* Manually do line wrapping so that it (probably) won't get wrapped at any embedded spaces. */ - space (stream, 1 + nl - fdoc); + space (stream, 1 + nl - cp); - __argp_fmtstream_write (stream, fdoc, nl - fdoc); + __argp_fmtstream_write (stream, cp, nl - cp); } if (fdoc && fdoc != tdoc) free ((char *)fdoc); /* Free user's modified doc string. */ -- cgit v1.2.3