summaryrefslogtreecommitdiff
path: root/lib/argmatch.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-12-29 12:02:43 +0000
committerJim Meyering <jim@meyering.net>1997-12-29 12:02:43 +0000
commitf7d4fc0e38521b185c0b46de39fef3225d99b89e (patch)
treea1782a295c97ef89a0f859e794fd27afc30d7c60 /lib/argmatch.c
parent3531b69552a756d69106158b6c42dea113ec2429 (diff)
downloadcoreutils-f7d4fc0e38521b185c0b46de39fef3225d99b89e.tar.xz
(invalid_arg): Use a single fprintf and whole
format statements to ease translation. Convert from K&R to ANSI function dcls.
Diffstat (limited to 'lib/argmatch.c')
-rw-r--r--lib/argmatch.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/argmatch.c b/lib/argmatch.c
index aa5593329..f180f1a26 100644
--- 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 @@ argmatch (arg, optlist)
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);
}