Commit Graph

4 Commits

Author SHA1 Message Date
Andrey A. Chernov
2a3fabc4d3 All cosmetic.
1) Rename RANDOM_MAX to RANDOM_MAX_PLUS1 to not confuse with random()'s max
2) Use calloc() instead of zeroing fields explicitly
3) "too many lines" -> "too many delimiters" for err()
2008-08-10 11:31:56 +00:00
Andrey A. Chernov
67cc8dbb1a I was confused a bit by the wrong construction with RAND_MAX
used in randomize_fd.c.
Although the max value is the same currently, RAND_MAX is for rand(),
not for random().
So move RANDOM_MAX const to the common file now, make it UL and
use in randomize_fd.c too.
(in any case its old value was 1 less then must be, as noted in
the prev. commit)
2008-08-08 01:42:17 +00:00
Sean Chittenden
3f4b504568 flexlint rears its head as well as some style(9) fixes[1]. Fixed a
few bugs for a few corner cases and correctly handle the case where
read(2) is read()'ing from a non-file descriptor and could get fewer
bytes back than the buffer, but it isn't EOF[2].  random(6) extensively
tested and believed to be bug free (save performance for large files).

Submitted by:	mkm [1], tjr[2]
2003-02-15 10:26:10 +00:00
Sean Chittenden
a3b3a1cf6c Update random(6) to have the ability to randomize a file/stdin based
off of lines or words.  See the man page for details.

Reviewed by:	markm
MFC after:	3 days
2003-02-11 19:32:18 +00:00