Mercurial > hg > octave-lyh > gnulib-hg
changeset 1189:5eb3b15fe669
(invalid_arg): Use a single fprintf and whole
format statements to ease translation.
Convert from K&R to ANSI function dcls.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Mon, 29 Dec 1997 12:02:43 +0000 |
parents | 4124515f1fcd |
children | 5ff7080eb4ba |
files | lib/argmatch.c |
diffstat | 1 files changed, 6 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -39,9 +39,7 @@ or -2 if it is ambiguous (is a prefix of more than one element). */ int -argmatch (arg, optlist) - const char *arg; - const char *const *optlist; +argmatch (const char *arg, const char *const *optlist) { int i; /* Temporary index in OPTLIST. */ size_t arglen; /* Length of ARG. */ @@ -78,15 +76,10 @@ PROBLEM is the return value from argmatch. */ void -invalid_arg (kind, value, problem) - const char *kind; - const char *value; - int problem; +invalid_arg (const char *kind, const char *value, int problem) { - fprintf (stderr, "%s: ", program_name); - if (problem == -1) - fprintf (stderr, "invalid"); - else /* Assume -2. */ - fprintf (stderr, "ambiguous"); - fprintf (stderr, " %s `%s'\n", kind, value); + const char *fmt = (problem == -1 + ? "%s: invalid %s `%s'\n" + : "%s: ambiguous %s `%s'\n"); + fprintf (stderr, fmt, program_name, kind, value); }