This allows an endless stream of random data within the given bounds.
It already worked if a seed was provided as the 4th argument but not
if one was left out.
In collaboration with: jhb
MFC after: 2 weeks
Relnotes: yes
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.
Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96
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
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
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
- 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
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
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
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>
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.
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
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.
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