`shuf -i 1-x' complained "shuf: invalid input range `x'", but the
invalid range is actually `1-x'.  I installed this:

2006-09-18  Paul Eggert  <[EMAIL PROTECTED]>

        * src/shuf.c (main): Quote the entire range when reporting an
        invalid one, rather than just the part that contained the error.

--- src/shuf.c  9 Aug 2006 18:07:43 -0000       1.2
+++ src/shuf.c  18 Sep 2006 20:36:50 -0000
@@ -279,6 +279,7 @@ main (int argc, char **argv)
        {
          unsigned long int argval = 0;
          char *p = strchr (optarg, '-');
+         char const *hi_optarg = optarg;
          bool invalid = !p;
 
          if (input_numbers_option_used (lo_input, hi_input))
@@ -292,10 +293,10 @@ main (int argc, char **argv)
                         || SIZE_MAX < argval);
              *p = '-';
              lo_input = argval;
-             optarg = p + 1;
+             hi_optarg = p + 1;
            }
 
-         invalid |= ((xstrtoul (optarg, NULL, 10, &argval, NULL)
+         invalid |= ((xstrtoul (hi_optarg, NULL, 10, &argval, NULL)
                       != LONGINT_OK)
                      || SIZE_MAX < argval);
          hi_input = argval;


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to