bug-findutils
[Top][All Lists]
Advanced

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

[PATCH] xargs: better error message for xargs -s notanumber.


From: James Youngman
Subject: [PATCH] xargs: better error message for xargs -s notanumber.
Date: Sun, 24 Jan 2016 21:17:18 +0000

* xargs/xargs.c (parse_num): Specify the value passed for the
invalid argument to make it easier to debug things when bug
reports don't specify the actual command line.
---
 xargs/xargs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xargs/xargs.c b/xargs/xargs.c
index 18393cd..fd9b313 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -1610,15 +1610,15 @@ parse_num (char *str, int option, long int min, long 
int max, int fatal)
   val = strtol (str, &eptr, 10);
   if (eptr == str || *eptr)
     {
-      fprintf (stderr, _("%s: invalid number for -%c option\n"),
-              program_name, option);
+      fprintf (stderr, _("%s: invalid number \"%s\" for -%c option\n"),
+              program_name, str, option);
       usage (stderr);
       exit (EXIT_FAILURE);
     }
   else if (val < min)
     {
-      fprintf (stderr, _("%s: value for -%c option should be >= %ld\n"),
-              program_name, option, min);
+      fprintf (stderr, _("%s: value %s for -%c option should be >= %ld\n"),
+              program_name, str, option, min);
       if (fatal)
        {
          usage (stderr);
@@ -1631,8 +1631,8 @@ parse_num (char *str, int option, long int min, long int 
max, int fatal)
     }
   else if (max >= 0 && val > max)
     {
-      fprintf (stderr, _("%s: value for -%c option should be <= %ld\n"),
-              program_name, option, max);
+      fprintf (stderr, _("%s: value %s for -%c option should be <= %ld\n"),
+              program_name, str, option, max);
       if (fatal)
        {
          usage (stderr);
-- 
2.1.4




reply via email to

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