changeset 21310:34c6a09726d8

(argmatch_invalid): Remove double quotes from the offending quoted argument before using it in explanatory diagnostic. Use a single fprintf stmt.
author Jim Meyering <jim@meyering.net>
date Sat, 02 Jan 1999 20:35:06 +0000
parents 8d6a57f292d8
children 5107b386f1c4
files lib/argmatch.c
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lib/argmatch.c	Sat Jan 02 20:07:04 1999 +0000
+++ b/lib/argmatch.c	Sat Jan 02 20:35:06 1999 +0000
@@ -130,6 +130,8 @@
 argmatch_invalid (const char *kind, const char *value, int problem)
 {
   enum quoting_style saved_quoting_style;
+  char const *format;
+  char *quoted_arg;
 
   /* Make sure to have a good quoting style to report errors.
      literal is insane here. */
@@ -137,14 +139,17 @@
   set_quoting_style (NULL, ARGMATCH_QUOTING_STYLE);
 
   /* There is an error */
-  fprintf (stderr, "%s: ", program_name);
-  if (problem == -1)
-    fprintf (stderr, _("invalid argument %s for `%s'"),
-	     quotearg (value), kind);
-  else				/* Assume -2.  */
-    fprintf (stderr, _("ambiguous argument %s for `%s'"),
-	     quotearg (value), kind);
-  putc ('\n', stderr);
+  quoted_arg = quotearg (value);
+
+  /* Skip over the first quote character, and overwrite the last one.  */
+  ++quoted_arg;
+  quoted_arg[strlen (quoted_arg) - 1] = '\0';
+
+  format = (problem == -1
+	    ? _("%s: invalid argument `%s' for `%s'\n")
+	    : _("%s: ambiguous argument `%s' for `%s'\n"));
+
+  fprintf (stderr, format, program_name, quoted_arg, kind);
 
   set_quoting_style (NULL, saved_quoting_style);
 }