diff options
| author | Pádraig Brady <P@draigBrady.com> | 2013-01-22 11:13:16 +0000 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2013-01-26 02:37:13 +0000 |
| commit | 2238ab574191d30b89a007b760c616efaf9c219c (patch) | |
| tree | 289b6fe06491cb9c30ceac15d607985c07d0981c /src | |
| parent | seq: fix misaligment with -w when no precision for start value (diff) | |
| download | coreutils-2238ab574191d30b89a007b760c616efaf9c219c.tar.gz coreutils-2238ab574191d30b89a007b760c616efaf9c219c.zip | |
seq: fix to always honor the step value
* src/seq.c (main): With 3 positive integer args we were
checking the end value was == "1", rather than the step value.
* tests/misc/seq.pl: Add tests for this case.
Reported by Marcel Böhme in http://bugs.gnu.org/13525
Diffstat (limited to 'src')
| -rw-r--r-- | src/seq.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -565,11 +565,12 @@ main (int argc, char **argv) then use the much more efficient integer-only code. */ if (all_digits_p (argv[optind]) && (n_args == 1 || all_digits_p (argv[optind + 1])) - && (n_args < 3 || STREQ ("1", argv[optind + 2])) + && (n_args < 3 || (STREQ ("1", argv[optind + 1]) + && all_digits_p (argv[optind + 2]))) && !equal_width && !format_str && strlen (separator) == 1) { char const *s1 = n_args == 1 ? "1" : argv[optind]; - char const *s2 = n_args == 1 ? argv[optind] : argv[optind + 1]; + char const *s2 = argv[optind + (n_args - 1)]; if (seq_fast (s1, s2)) exit (EXIT_SUCCESS); |
