Home | History | Annotate | Download | only in jot
History log of /src/usr.bin/jot/jot.c
RevisionDateAuthorComments
 1.28  14-Jun-2020  kamil Generate format after setting the prec value

Otherwise we end up with setting invalid printf format: "%.-1f" (from
"if (snprintf(p, sz, "%%.%df", prec) >= (int)sz)") for prec equal to -1,
which is not canonical (rejected by gcc and clang when used explicitly).

Detected by ASan (MKSANITIZER) for "jot 8".
 1.27  03-Feb-2019  mrg - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.26  25-Jun-2018  christos branches: 1.26.2;
Don't require any arguments as the usage indicates; simplifies the code
and the documentation: now "jot" works like "jot -" used to (and continues
to). From Ingo Schwarze
 1.25  12-Apr-2009  lukem branches: 1.25.44;
fix sign-compare issue
 1.24  21-Jul-2008  lukem branches: 1.24.6;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.23  21-Apr-2008  dsl branches: 1.23.2;
Fix integer random numbers when bounds given in the wrong order.
 1.22  02-Mar-2008  dsl branches: 1.22.2;
When printing non-random integers, add 0.5 to get 'schoolboy' rounding.
This makes 'jot - 9 - -.5' generate 9 9 8 8 etc again.
When printing random numbers generate a sane range when ender < begin.
For random integers we must use random()/2^31 since we don't want the
value above generated should random() return 2^31-1.
 1.21  29-Feb-2008  dsl Remove the loop used to set default and calculated parameters, instead
set the defaults at compile time and calculate any derived values in
a simple switch statement.
Use names for the bit-patterns that indicate that fields are present.
Seems to behave the same way as the earlier version.
 1.20  27-Feb-2008  dsl Sprinkle 'static' and 'EXIT_FAILURE'. Use getopt().
Simplify getprec() using libc functions.
Code from me partially inspired by a diff sent by xtos.
 1.19  24-Feb-2008  dsl When converting fp values to integer, use floor(x) so that we get
consistent convertions not the 'round to even'.
This means that it is possibly to generate the 'stuttered' sequence
4 4 3 3 2 2 1 1 0 0 -1 -1.
 1.18  23-Feb-2008  dsl Rename 's' to 'step', allow a precision of 0 to be specified (overriding
the value determined from 'begin' and 'end').
 1.17  23-Feb-2008  dsl If we are doing a random integer (or character) format, then increase the
range by 1 so that the quoted upper and lower values both appear, and
with the same frequency as the intermediate values.
This reverts the change from rev 1.13, and fixes it properly!
Also fixes 'jot -r -c - 97 98' as reported to netbsd-bugs (but not as a PR!).
 1.16  23-Feb-2008  dsl Remove some pointless indirections and add {} around some long single
statements.
 1.15  13-Jun-2006  christos branches: 1.15.10; 1.15.16;
PR/33709: Kevin Massey: Avoid stack smashing in args copy
 1.14  07-Jan-2006  garbled branches: 1.14.2;
Apply modified fix for PR bin/23763
jot(1)'s output now matches the examples given in the manpage.
 1.13  04-Jan-2006  perry de-__P, ANSIfy prototypes
 1.12  22-Nov-2004  peter Sort options, standardize usage message.

ok wiz@
 1.11  05-Jan-2004  jmmv Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
 1.10  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.9  27-Sep-2002  atatat Make the randomness a tad more random. It's still not terribly
random, but it's considerably less lame now.

before% echo `jot -r 5` ; echo `jot -r 5`
66 5 78 82 66
66 5 78 82 66

after% echo `jot -r 5` ; echo `jot -r 5`
15 94 47 32 25
78 52 73 52 47
 1.8  17-Mar-2001  simonb Reverse the if and else clauses for the chardata test if there is
no format string specified.

Fixes PR bin/12424 from Jim Bernard.
 1.7  14-Mar-2001  jdolecek Use patch provided Paul Janzen <pjanzen@OpenBSD.org> to fix
bin/12316 more completely.
Highlights:
* we only allow explicitly specified set of (numberic) formats
* %% is correctly skipped, extra %foo formats are detected
* '*' in format specification is not allowed

The code in getformat() is slighly different to the OpenBSD version
of fix - the list of allowed printf(3) flags is explicit and the
condition checking 'chardata' is written slighly differently.

Also pull-in some cosmetic changes from OpenBSD - s/isdefault()/is_default()/,
error() -> errx(), usage().
 1.6  02-Mar-2001  jdolecek Don't coredump if format given via -w doesn't contain alphanumeric
character; in such case, warn user the format is invalid.

This addresses bin/12316 by Perry E. Metzger.
 1.5  19-Dec-1998  christos branches: 1.5.10;
char -> unsigned char
 1.4  19-Oct-1997  lukem WARNSify, fix .Nm usage, deprecate register, use <err.h>
 1.3  02-Dec-1994  pk Allocate proper storage.
Avoid interpretation of boring words as printf(3) style format strings.
 1.2  14-Nov-1994  jtc Changed to conform to NetBSD's new RCS Id convention.
 1.1  14-Nov-1994  jtc branches: 1.1.1;
Initial revision
 1.1.1.1  14-Nov-1994  jtc imported from 4.4lite
 1.5.10.1  25-Nov-2001  he Pull up revisions 1.6-1.8 (requested by jdolecek):
Check the format string more thoroughly before use. Fixes PR#12316
and PR#14253.
 1.14.2.1  19-Jun-2006  chap Sync with head.
 1.15.16.1  24-Mar-2008  keiichi sync with head.
 1.15.10.1  23-Mar-2008  matt sync with HEAD
 1.22.2.1  18-May-2008  yamt sync with head.
 1.23.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.24.6.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.25.44.1  28-Jul-2018  pgoyette Sync with HEAD
 1.26.2.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed