History log of /freebsd-10-stable/usr.bin/jot/jot.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 216370 11-Dec-2010 joel

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with: imp, rwatson


# 208728 02-Jun-2010 brian

Fix stuttering sequences and reverse ranges

PR: 123635
Submitted by: Ulrich Spörlein, uqs at spoerlein dot net


# 200462 13-Dec-2009 delphij

Revert most part of 200420 as requested, as more review and polish is
needed.


# 200420 11-Dec-2009 delphij

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


# 195443 08-Jul-2009 brian

Fix some uninitialise variables.

PR: 136383
Submitted by: Ulrich Spoerlein - uqs at spoerlein dot net
Approved by: re (kib)
MFC after: 3 weeks


# 165029 09-Dec-2006 delphij

Use explicit braces to avoid ambiguous else.


# 164852 03-Dec-2006 dds

Prevent buffer overflow when forcibly terminating an escape character.

Obtained from: OpenBSD
Note: In the case of a full buffer the OpenBSD implementation will
leave in the format string an invalid escape sequence. This appears
to be harmless with our C library, but according to C99 this can
cause undefined behavior.

MFC after: 2 weeks


# 164851 03-Dec-2006 dds

Correct handling of format strings with escaped % specifications.

Note: It would be nice to be able to implement getformat() using
fmtcheck(3), but fmtcheck does not distinguish between signed and
unsigned types, a facility jot needs to perform range checks on its
output.

Submitted by: Per Kristian Hove
MFC after: 2 weeks


# 164046 06-Nov-2006 dds

Style facelift.
- Reduce the number of global variables
- Make global objects static
- Use bool consistently
- Sort getopt arguments and their processing
- Add function comments
- Change notlast != 0 into !last


# 164043 06-Nov-2006 dds

Use a more sensible default of 1 or -1 when only the start and
end values are specified.

PR: bin/68981
Submitted by: Stefan `Sec` Zehl
MFC after: 2 weeks


# 164035 06-Nov-2006 dds

Do What I Mean when the user asks for random integers or characters.
Up to now jot would fail to generate the last character in the range
or skew the integer distribution in a way that would generate the numbers
in the range's limits with half the probability of the rest.

This modification fixes the program, rather than documenting the
strange behavior, as suggested in docs/54879.

Also, correctly specify the range of random(3).

PR: docs/54879
MFC after: 2 weeks


# 164028 06-Nov-2006 dds

Avoid negative array indices: an empty string can also be used
to specify a default value.


# 164026 06-Nov-2006 dds

Restore jot's ability to use a seed for producing a deterministic
sequence of random numbers.
This functionality was lost in revision 1.9 when the random number
generator was switched to arc4random.

PR: docs/54879
MFC after: 2 weeks


# 164025 06-Nov-2006 dds

Replace obscure aliases through pointers with plain variables.

MFC after: 2 weeks


# 164023 06-Nov-2006 dds

Merge code in common cases.

Verified by: New regression tests in tools/regression/usr.bin/jot
MFC after: 2 weeks


# 164021 06-Nov-2006 dds

Replace opaque numeric bit flag values with #defined identifiers.
While there, add some missing FALLTHROUGH comments.

Verified with: cmp(1) on the executable
MFC after: 2 weeks


# 132240 16-Jul-2004 tjr

Avoid passing negative values to <ctype.h> functions on machines with
signed chars.


# 118310 01-Aug-2003 das

Fix jot so that 'jot -r -w %d 1 1 4' never prints 4. Previously, it
would print it with probability 1/2**32. It seems that the correct
behavior is to print 4 with probability 1/4, but I'd like to avoid
breaking POLA until all the range inconsistencies in jot can be fixed
in one pass. See PR for details.

PR: 54878
Submitted by: David Brinegar <jot.3.brinegar@spamgourmet.com>


# 99457 05-Jul-2002 mike

Don't depend on pollution in <limits.h> for the definition of
<stdint.h> macros.


# 99112 30-Jun-2002 obrien

Consistently use FBSDID


# 98255 15-Jun-2002 jmallett

Remove local prototype for main().


# 98254 15-Jun-2002 jmallett

Protoize. Remove un-needed cast to char in switch of getopt(3)'s return value.
FBSDID.


# 92920 21-Mar-2002 imp

remove __P


# 86197 08-Nov-2001 wollman

Actually, arc4random() returns a uint32_t, not an int. Use the correct
constant, just in case uint32_t turns into a `short' ten years from now.
If this is MFC'd it will be necessary to hard-code the constant since
-stable doesn't have UINT32_MAX.


# 86196 08-Nov-2001 gallatin

fix jot -r on 64-bit platforms by teaching it that arc4random outputs
an int, not a long

Submitted by: Paul Herman <pherman@frenchfries.net>
PR#: alpha/31859


# 77441 29-May-2001 dd

Replace the cast I removed in rev. 1.16 with a slightly less evil one
(well, at least one that gcc doesn't complain about). This fixes -r,
which rev. 1.16 broke.

Submitted by: bde


# 77287 27-May-2001 dd

Silence warnings and compile with WARNS=2 on i386 and alpha.


# 77276 27-May-2001 dd

Miscellaneous cleanups; sync to OpenBSD as much as feasible.
Noteworthy changes include:
* Use getopt(3).
* Fix overflows in -b and -w options.
* Use strlcpy(3) and snprintf(3) in favor of strcpy(3) and
sprintf(3), respectively. Also check return values of the former
two.
* Fix lots of other gratuitous differences with OpenBSD.

Obtained from: OpenBSD


# 62871 10-Jul-2000 kris

Don't call printf with no format string.


# 55515 06-Jan-2000 sheldonh

Back out rev 1.11, about which bde had concerns, and instead implement
appropriate bounds-checking and typecasts based on our knowledge of
the desired conversion format specifier.

Simplify diagnostics and take care to print the correct conversion
format specifier when %l is involved.


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48997 22-Jul-1999 sheldonh

Don't dump core for a known, documented bug.

PR: 12611
Reviewed by: markm


# 48995 22-Jul-1999 sheldonh

Improve printf(3) conversion specifier parsing so that silly formats
aren't allowed and the right casts can be used for printf() statements.

Document the conversion specifier limitations and the fact that
arithmetic overflow causes a fatal error.

PR: 12611
Reported by: Frode Vatvedt Fjeld <frodef@acm.org>
Reviewed by: bde


# 47107 13-May-1999 kris

Correct an error in a manpage example, add -Wall -W to Makefile (no
warnings given) and modify source to use arc4random() instead of random().

Reviewed by: ache


# 30908 03-Nov-1997 charnier

Mdoc'ify man page.


# 27423 15-Jul-1997 charnier

Use err(3) instead of local redefinition. Add usage().


# 26626 13-Jun-1997 ache

Remove srandomdev fallback code


# 24419 30-Mar-1997 ache

Use srandomdev() now
Fix error with begin variable calculation


# 23698 11-Mar-1997 ache

Fix srandom arg type according to Lite2


# 23511 08-Mar-1997 ache

Add ^ getpid() to make more random results for subsequent calling.
Add proper type casting to random calls

Should go into 2.2


# 13101 29-Dec-1995 joerg

>Number: 917
>Category: bin
>Synopsis: -s option in jot is broken


# 1591 27-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1590,
which included commits to RCS files with non-trunk default branches.


# 1590 27-May-1994 rgrimes

BSD 4.4 Lite Usr.bin Sources