summaryrefslogtreecommitdiff
path: root/libshouldbeinlibc
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-06-18 16:29:05 +0000
committerMiles Bader <miles@gnu.org>1997-06-18 16:29:05 +0000
commita44b384f25696e3ca00c8e9f72a8cdebd209ec31 (patch)
tree8f801f9b7355de2f6fae90b08a733dd4f7899cf6 /libshouldbeinlibc
parent5ef0f568dcd0422dcd71849a7c6ccd458a41ae7f (diff)
(argp_args_usage):
Don't modify `fdoc' value since it is used to distinguish filtered strings from unmodifed strings.
Diffstat (limited to 'libshouldbeinlibc')
-rw-r--r--libshouldbeinlibc/argp-help.c13
1 files changed, 7 insertions, 6 deletions
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. */