]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Correct preceding patch.
authorJim Meyering <meyering@redhat.com>
Sat, 17 Nov 2007 09:04:07 +0000 (10:04 +0100)
committerJim Meyering <meyering@redhat.com>
Sat, 17 Nov 2007 09:04:07 +0000 (10:04 +0100)
* src/seq.c (print_numbers): Also handle first < last && step < 0.
* tests/misc/seq [empty-rev]: New test for this case.

ChangeLog
src/seq.c
tests/misc/seq

index d563ae900a18e173db765f64c77f14ecab169729..6e6f713b2aec0b9f29640b849dcd97331b028a1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2007-11-17  Jim Meyering  <meyering@redhat.com>
 
+       Correct preceding patch.
+       * src/seq.c (print_numbers): Also handle first < last && step < 0.
+       * tests/misc/seq [empty-rev]: New test for this case.
+
        "seq .1 .1" would mistakenly generate no output on some systems
        * NEWS: Say this.
        * src/seq.c (print_numbers): Handle another floating point corner case.
index 77d5586974a52dc3a91e9e24d17fb084d53f8cec..eec5ed5549d464c203e02ca1f5b9427030364358 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -285,7 +285,7 @@ print_numbers (char const *fmt, struct layout layout,
             Hence the first conjunct: don't break out of this loop when
             i == 0.  *unless* first and last themselves are out of order,
             in which case we must print nothing, e.g. for ./seq -1  */
-         if (i || last < first)
+         if (i || (0 < step && last < first) || (step < 0 && first < last))
            break;
        }
 
index 17c8f0c6c1272585e93085310068fef7e1243d16..3365d9521a1b3d5dc306b65ba8ff19b75ffc3121 100755 (executable)
@@ -42,6 +42,7 @@ my @Tests =
   (
    ['onearg-1',        qw(10),         {OUT => [(1..10)]}],
    ['onearg-2',        qw(-1)],
+   ['empty-rev', qw(1 -1 3)],
    ['neg-1',   qw(-10 10 10),  {OUT => [qw(-10 0 10)]}],
    # ['neg-2', qw(-.1 .1 .11), {OUT => [qw(-0.1 0.0 0.1)]}],
    ['neg-3',   qw(1 -1 0),     {OUT => [qw(1 0)]}],