mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
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
This commit is contained in:
1 parent
326e5855bc
commit
2238ab5741
3 files changed
+16
-3
No files matched your search
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user