bin/68981: unlogic jot behaviour.

Stefan `Sec` Zehl sec at 42.org
Tue Jul 13 03:20:18 PDT 2004


>Number:         68981
>Category:       bin
>Synopsis:       unlogic jot behaviour.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 13 10:20:17 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Stefan `Sec` Zehl
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
>Environment:
System: FreeBSD ice 4.9-STABLE FreeBSD 4.9-STABLE #11: Sun Jan 25 15:43:27 CET 2004 root at ice:/export/obj/export/src/sys/ICE i386


	
>Description:

If you want to generate a simple integer sequence with jot, it behaves
illogical.

jot 10 1
and
jot 10 - 10 

work as expected (generating 1-10), but

jot - 1 10

generates each number a few times. From reading the source && manual,
I realize this is because it forces reps=100.

This behaviour seems unlogic to me, and it certainly isn't usefull to
anybody, thus I have created a patch to force s=1 in these cases.

I also default s=-1 in case the start is bigger than the end, otherwise
you would just get an "impossible stepsize" error.

I would be happy if this could be included :)
	
>How-To-Repeat:
	
>Fix:

	

--- jot.c.org	Sun Dec 30 20:37:27 2001
+++ jot.c	Tue Jul 13 11:56:19 2004
@@ -198,8 +198,8 @@
 			mask = 015;
 			break;
 		case 006:
-			reps = REPS_DEF;
-			mask = 016;
+			s = ender>begin?1:-1;
+			mask = 007;
 			break;
 		case 007:
 			if (randomize) {
--- jot.1.org	Tue Jul 16 13:52:09 2002
+++ jot.1	Tue Jul 13 11:59:04 2004
@@ -114,7 +114,7 @@
 If fewer than three are specified, defaults are assigned
 left to right, except for
 .Ar s ,
-which assumes its default unless both
+which assumes a default of 1 or -1 if both
 .Ar begin
 and
 .Ar end



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list