Commit Graph

25 Commits

Author SHA1 Message Date
lukem 39a84db38a fix sign-compare issue 2009-04-12 11:19:18 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
dsl 9890613c15 Fix integer random numbers when bounds given in the wrong order. 2008-04-21 20:33:41 +00:00
dsl 1b00238d8c 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.
2008-03-02 21:33:42 +00:00
dsl 93190b890c 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.
2008-02-29 22:43:48 +00:00
dsl f127a329db Sprinkle 'static' and 'EXIT_FAILURE'. Use getopt().
Simplify getprec() using libc functions.
Code from me partially inspired by a diff sent by xtos.
2008-02-27 22:47:32 +00:00
dsl 2791dfc743 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.
2008-02-24 00:04:00 +00:00
dsl 9d6613d400 Rename 's' to 'step', allow a precision of 0 to be specified (overriding
the value determined from 'begin' and 'end').
2008-02-23 23:59:59 +00:00
dsl a357ac4921 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!).
2008-02-23 22:46:10 +00:00
dsl c4d8b28d09 Remove some pointless indirections and add {} around some long single
statements.
2008-02-23 22:26:41 +00:00
christos 7afd9e136a PR/33709: Kevin Massey: Avoid stack smashing in args copy 2006-06-13 03:22:00 +00:00
garbled d8817d5ac1 Apply modified fix for PR bin/23763
jot(1)'s output now matches the examples given in the manpage.
2006-01-07 07:09:01 +00:00
perry 10e955c2f8 de-__P, ANSIfy prototypes 2006-01-04 01:44:06 +00:00
peter 2c12af6a77 Sort options, standardize usage message.
ok wiz@
2004-11-22 17:34:24 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
atatat 3db0e47b56 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
2002-09-27 20:54:51 +00:00
simonb 618d628845 Reverse the if and else clauses for the chardata test if there is
no format string specified.

Fixes PR bin/12424 from Jim Bernard.
2001-03-17 11:43:06 +00:00
jdolecek 507cbfd5d0 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().
2001-03-14 07:50:06 +00:00
jdolecek 13cb1a6488 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.
2001-03-02 21:17:31 +00:00
christos 844b3dce90 char -> unsigned char 1998-12-19 17:06:20 +00:00
lukem ac4e9aa74a WARNSify, fix .Nm usage, deprecate register, use <err.h> 1997-10-19 03:32:11 +00:00
pk 22e62219f7 Allocate proper storage.
Avoid interpretation of boring words as printf(3) style format strings.
1994-12-02 20:29:43 +00:00
jtc 6e0c4ded79 Changed to conform to NetBSD's new RCS Id convention. 1994-11-14 20:27:21 +00:00
jtc 9636069c3e imported from 4.4lite 1994-11-14 20:11:58 +00:00