From 2238ab574191d30b89a007b760c616efaf9c219c Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Tue, 22 Jan 2013 11:13:16 +0000 Subject: seq: fix to always honor the step value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- src/seq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/seq.c b/src/seq.c index 5ad5fad94..acbe2350a 100644 --- a/src/seq.c +++ b/src/seq.c @@ -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); -- cgit v1.2.3-54-g00ecf