tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: jot: producing too much output?



Actually, replace that last patch with this one.   The previous one
wouldn't work if begin and end were the same value (intending to get
just one output value) - though why anyone would write the args that
way instead of just saying 1 reps begin at ... I cannot imagine.

This patch doesn't have that defect however.

kre

Index: jot.c
===================================================================
RCS file: /cvsroot/src/usr.bin/jot/jot.c,v
retrieving revision 1.28
diff -u -r1.28 jot.c
--- jot.c	14 Jun 2020 01:26:46 -0000	1.28
+++ jot.c	5 Jan 2023 16:20:17 -0000
@@ -249,6 +249,9 @@
 
 	switch (have) {
 
+	case ENDER | BEGIN:
+		step = ender >= begin ? 1.0 : -1.0;
+		/* FALLTHROUGH */
 	case ENDER | STEP:
 	case ENDER | STEP | BEGIN:
 		/* Calculate reps */




Home | Main Index | Thread Index | Old Index