bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] argmatch: don't hard-code `' when listing valid option arguments


From: Jim Meyering
Subject: [PATCH] argmatch: don't hard-code `' when listing valid option arguments
Date: Mon, 12 Dec 2011 11:51:39 +0100

FYI,

>From f5c2e2ac7d4ca2f6ba15e56a245f348899360a00 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 12 Dec 2011 10:57:17 +0100
Subject: [PATCH] argmatch: don't hard-code `' when listing valid option
 arguments

* lib/argmatch.c (argmatch_valid): Don't hard-code `%s'.  Instead,
use the quote function to add quotes.  Use fputs rather than
fprintf for the format string with no format directive.
---
 ChangeLog      |    7 +++++++
 lib/argmatch.c |    6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 455bb6a..79cbf7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-12-12  Jim Meyering  <address@hidden>
+
+       argmatch: don't hard-code `' when listing valid option arguments
+       * lib/argmatch.c (argmatch_valid): Don't hard-code `%s'.  Instead,
+       use the quote function to add quotes.  Use fputs rather than
+       fprintf for the format string with no format directive.
+
 2011-12-07  Eric Blake  <address@hidden>

        bootstrap: detect tools required by gnulib-tool
diff --git a/lib/argmatch.c b/lib/argmatch.c
index 9a3eca4..6adbef6 100644
--- a/lib/argmatch.c
+++ b/lib/argmatch.c
@@ -150,17 +150,17 @@ argmatch_valid (const char *const *arglist,

   /* We try to put synonyms on the same line.  The assumption is that
      synonyms follow each other */
-  fprintf (stderr, _("Valid arguments are:"));
+  fputs (_("Valid arguments are:"), stderr);
   for (i = 0; arglist[i]; i++)
     if ((i == 0)
         || memcmp (last_val, vallist + valsize * i, valsize))
       {
-        fprintf (stderr, "\n  - `%s'", arglist[i]);
+        fprintf (stderr, "\n  - %s", quote (arglist[i]));
         last_val = vallist + valsize * i;
       }
     else
       {
-        fprintf (stderr, ", `%s'", arglist[i]);
+        fprintf (stderr, ", %s", quote (arglist[i]));
       }
   putc ('\n', stderr);
 }
--
1.7.8.163.g9859a



reply via email to

[Prev in Thread] Current Thread [Next in Thread]