seq: fix yet another case of negative parameters not working
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
cb57abb46f
commit
478b5ac2bc
2 changed files with 7 additions and 2 deletions
|
@ -57,8 +57,12 @@ int seq_main(int argc, char **argv)
|
||||||
saved = argv[++n];
|
saved = argv[++n];
|
||||||
if (!saved)
|
if (!saved)
|
||||||
break;
|
break;
|
||||||
if (saved[0] != '-')
|
if (saved[0] != '-') {
|
||||||
break;
|
// break; // "seq -s : -1 1" won't be treated correctly
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// "seq -s -1 1 9" is not treated correctly, but such usage
|
||||||
|
// (delimiter string which looks like negative number) is very unlikely
|
||||||
c = saved[1];
|
c = saved[1];
|
||||||
if (c == '.' || (c >= '0' && c <= '9')) {
|
if (c == '.' || (c >= '0' && c <= '9')) {
|
||||||
argv[n] = NULL;
|
argv[n] = NULL;
|
||||||
|
|
|
@ -45,5 +45,6 @@ testing "seq count by .3 with padding 2" "seq -w 03 .3 0004" "0003.0\n0003.3\n00
|
||||||
|
|
||||||
testing "seq from -4 count down by 2" "seq -4 -2 -8" "-4\n-6\n-8\n" "" ""
|
testing "seq from -4 count down by 2" "seq -4 -2 -8" "-4\n-6\n-8\n" "" ""
|
||||||
testing "seq from -.0 count down by .25" "seq -.0 -.25 -.9" "-0.00\n-0.25\n-0.50\n-0.75\n" "" ""
|
testing "seq from -.0 count down by .25" "seq -.0 -.25 -.9" "-0.00\n-0.25\n-0.50\n-0.75\n" "" ""
|
||||||
|
testing "seq -s : with negative start" "seq -s : -1 1" "-1:0:1\n" "" ""
|
||||||
|
|
||||||
exit $FAILCOUNT
|
exit $FAILCOUNT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue