[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
minor improvement in 'shuf -i badrange' diagnostic
From: |
Paul Eggert |
Subject: |
minor improvement in 'shuf -i badrange' diagnostic |
Date: |
Mon, 18 Sep 2006 13:41:02 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
`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 <address@hidden>
* 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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- minor improvement in 'shuf -i badrange' diagnostic,
Paul Eggert <=