aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/jot/jot.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-9/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Fix 'jot -r 0 start end' to work.Bryan Drewery2019-04-161-6/+9
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=346255
* capsicum: use a new capsicum helpers in toolsMariusz Zaborski2018-11-041-1/+1
| | | | | | | Use caph_{rights,ioctls,fcntls}_limit to simplify the code. Notes: svn path=/head/; revision=340138
* Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.Mariusz Zaborski2018-06-191-1/+1
| | | | | | | No functional change intended. Notes: svn path=/head/; revision=335395
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=314436
* Capsicum support for jot(1)Conrad Meyer2016-10-191-0/+19
| | | | | | | | | | | | Limit descriptors and enter capability mode in jot(1). Submitted by: brueffer (earlier version) Reviewed by: emaste, jonathan (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D1345 Notes: svn path=/head/; revision=307660
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-111-4/+0
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=216370
* Fix stuttering sequences and reverse rangesBrian Somers2010-06-021-6/+13
| | | | | | | | PR: 123635 Submitted by: Ulrich Spörlein, uqs at spoerlein dot net Notes: svn path=/head/; revision=208728
* Revert most part of 200420 as requested, as more review and polish isXin LI2009-12-131-0/+1
| | | | | | | needed. Notes: svn path=/head/; revision=200462
* Remove unneeded header includes from usr.bin/ except contributed code.Xin LI2009-12-111-1/+0
| | | | | | | Tested with: make universe Notes: svn path=/head/; revision=200420
* Fix some uninitialise variables.Brian Somers2009-07-081-4/+4
| | | | | | | | | | PR: 136383 Submitted by: Ulrich Spoerlein - uqs at spoerlein dot net Approved by: re (kib) MFC after: 3 weeks Notes: svn path=/head/; revision=195443
* Use explicit braces to avoid ambiguous else.Xin LI2006-12-091-1/+2
| | | | Notes: svn path=/head/; revision=165029
* Prevent buffer overflow when forcibly terminating an escape character.Diomidis Spinellis2006-12-031-1/+3
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=164852
* Correct handling of format strings with escaped % specifications.Diomidis Spinellis2006-12-031-2/+5
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=164851
* Style facelift.Diomidis Spinellis2006-11-061-57/+73
| | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=164046
* Use a more sensible default of 1 or -1 when only the start andDiomidis Spinellis2006-11-061-1/+4
| | | | | | | | | | | end values are specified. PR: bin/68981 Submitted by: Stefan `Sec` Zehl MFC after: 2 weeks Notes: svn path=/head/; revision=164043
* Do What I Mean when the user asks for random integers or characters.Diomidis Spinellis2006-11-061-7/+32
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=164035
* Avoid negative array indices: an empty string can also be usedDiomidis Spinellis2006-11-061-1/+1
| | | | | | | to specify a default value. Notes: svn path=/head/; revision=164028
* Restore jot's ability to use a seed for producing a deterministicDiomidis Spinellis2006-11-061-6/+13
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=164026
* Replace obscure aliases through pointers with plain variables.Diomidis Spinellis2006-11-061-11/+8
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=164025
* Merge code in common cases.Diomidis Spinellis2006-11-061-29/+6
| | | | | | | | Verified by: New regression tests in tools/regression/usr.bin/jot MFC after: 2 weeks Notes: svn path=/head/; revision=164023
* Replace opaque numeric bit flag values with #defined identifiers.Diomidis Spinellis2006-11-061-29/+38
| | | | | | | | | | While there, add some missing FALLTHROUGH comments. Verified with: cmp(1) on the executable MFC after: 2 weeks Notes: svn path=/head/; revision=164021
* Avoid passing negative values to <ctype.h> functions on machines withTim J. Robbins2004-07-161-3/+3
| | | | | | | signed chars. Notes: svn path=/head/; revision=132240
* Fix jot so that 'jot -r -w %d 1 1 4' never prints 4. Previously, itDavid Schultz2003-08-011-1/+1
| | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=118310
* Don't depend on pollution in <limits.h> for the definition ofMike Barcroft2002-07-051-0/+1
| | | | | | | <stdint.h> macros. Notes: svn path=/head/; revision=99457
* Consistently use FBSDIDDavid E. O'Brien2002-06-301-1/+0
| | | | Notes: svn path=/head/; revision=99112
* Remove local prototype for main().Juli Mallett2002-06-151-1/+0
| | | | Notes: svn path=/head/; revision=98255
* Protoize. Remove un-needed cast to char in switch of getopt(3)'s return value.Juli Mallett2002-06-151-14/+10
| | | | | | | FBSDID. Notes: svn path=/head/; revision=98254
* remove __PWarner Losh2002-03-221-5/+5
| | | | Notes: svn path=/head/; revision=92920
* Actually, arc4random() returns a uint32_t, not an int. Use the correctGarrett Wollman2001-11-081-1/+1
| | | | | | | | | 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. Notes: svn path=/head/; revision=86197
* fix jot -r on 64-bit platforms by teaching it that arc4random outputsAndrew Gallatin2001-11-081-1/+1
| | | | | | | | | | an int, not a long Submitted by: Paul Herman <pherman@frenchfries.net> PR#: alpha/31859 Notes: svn path=/head/; revision=86196
* Replace the cast I removed in rev. 1.16 with a slightly less evil oneDima Dorfman2001-05-291-1/+1
| | | | | | | | | | (well, at least one that gcc doesn't complain about). This fixes -r, which rev. 1.16 broke. Submitted by: bde Notes: svn path=/head/; revision=77441
* Silence warnings and compile with WARNS=2 on i386 and alpha.Dima Dorfman2001-05-281-9/+9
| | | | Notes: svn path=/head/; revision=77287
* Miscellaneous cleanups; sync to OpenBSD as much as feasible.Dima Dorfman2001-05-271-81/+68
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=77276
* Don't call printf with no format string.Kris Kennaway2000-07-101-1/+1
| | | | Notes: svn path=/head/; revision=62871
* Back out rev 1.11, about which bde had concerns, and instead implementSheldon Hearn2000-01-061-52/+49
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=55515
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Don't dump core for a known, documented bug.Sheldon Hearn1999-07-221-1/+21
| | | | | | | | PR: 12611 Reviewed by: markm Notes: svn path=/head/; revision=48997
* Improve printf(3) conversion specifier parsing so that silly formatsSheldon Hearn1999-07-221-18/+82
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=48995
* Correct an error in a manpage example, add -Wall -W to Makefile (noKris Kennaway1999-05-131-6/+2
| | | | | | | | | warnings given) and modify source to use arc4random() instead of random(). Reviewed by: ache Notes: svn path=/head/; revision=47107
* Mdoc'ify man page.Philippe Charnier1997-11-031-3/+3
| | | | Notes: svn path=/head/; revision=30908
* Use err(3) instead of local redefinition. Add usage().Philippe Charnier1997-07-151-35/+28
| | | | Notes: svn path=/head/; revision=27423
* Remove srandomdev fallback codeAndrey A. Chernov1997-06-141-4/+3
| | | | Notes: svn path=/head/; revision=26626
* Use srandomdev() nowAndrey A. Chernov1997-03-301-5/+10
| | | | | | | Fix error with begin variable calculation Notes: svn path=/head/; revision=24419
* Fix srandom arg type according to Lite2Andrey A. Chernov1997-03-111-1/+1
| | | | Notes: svn path=/head/; revision=23698
* Add ^ getpid() to make more random results for subsequent calling.Andrey A. Chernov1997-03-081-5/+6
| | | | | | | | | Add proper type casting to random calls Should go into 2.2 Notes: svn path=/head/; revision=23511
* >Number: 917Joerg Wunsch1995-12-291-2/+2
| | | | | | | | >Category: bin >Synopsis: -s option in jot is broken Notes: svn path=/head/; revision=13101