[BusyBox] small seq bug?

Jean Wolter jw5 at os.inf.tu-dresden.de
Mon Feb 2 21:33:30 UTC 2004


Hello,

when calling seq with

    seq 1 1

it generates an "endless" list of numbers until the counter wraps and
reaches 1 again. The follwoing small patch should introduce the
expected behavior (output of 1 and termination):

diff -u -r1.1 -r1.2
--- seq.c	31 Jan 2004 12:22:57 -0000	1.1
+++ seq.c	1 Feb 2004 00:43:44 -0000	1.2
@@ -36,7 +36,7 @@
 	}
 	last = atof(argv[argc - 1]);
 
-	for (i = first; ((first < last) ? (i <= last): (i >= last));i += increment) {
+	for (i = first; ((first <= last) ? (i <= last): (i >= last));i += increment) {
 		printf("%g\n", i);
 	}
 
regards,
Jean



More information about the busybox mailing list