summaryrefslogtreecommitdiff
path: root/bin/sleep
AgeCommit message (Collapse)Author
2020-02-25sleep(1): style(9) and other dustingcheloha
- Sort includes alphabetically - Sort prototypes alphabetically - Sort stack variables by size - Add missing braces to the getopt(3) loop - Be explicit: there is *one* argument, so use argv[0], not *argv - If nanosleep(2) somehow fails, say that "nanosleep" failed when we err(3) - Remove extra parentheses from the return statement - De-(void) the obvious fprintf(3) in usage() - __progname -> getprogname(3) - POSIX 1003.2 has long since become POSIX.1 - Remove an ARGUSED linter comment - stdio(3) flushing is not the only potential issue with an exit(3) from a signal handler. Just note that exit(3) isn't safe and leave it at that.
2019-07-01sleep(1): simplify argument parsingcheloha
- No need for intermediate variables, just build the timespec directly - Use for-loops so we modify "cp" on a single line in each loop - Parse subseconds with one loop: less code, easier to read, etc. - Improve the subsecond parsing comment: make our intent really obvious ok schwarze@
2019-01-10Revert nanosleep(2) loop introduced in v1.25.cheloha
Now that nanosleep(2) handles the full input range transparently there is no longer a 100 million second upper bound and we can remove this loop. ok phessler@ jca@ visa@
2018-02-04Print strtonum(3)-style error messages on invalid numeric input.cheloha
More informative than the usage message. While here, no need to return EINVAL: just return 1 if we overflow. ok jca@ schwarze@
2018-02-02Extend range for seconds from 100 million to upper bound of time_t.cheloha
Makes us compliant with POSIX.1-2008, which requires that sleep(1) support up to 2147483647 seconds. Bounced off of tb@ and jca@. ok tb@ millert@ jca@
2016-08-16Add, correct, and improve HISTORY sections.Ingo Schwarze
From Sevan Janiyan <venture37 at geeklan dot co dot uk>. Verified using http://minnie.tuhs.org/.
2015-10-11Don't return errno from main()Philip Guenther
ok beck@ doug@ deraadt@ tedu@
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-03So you'd love me to say sleep() can be tighter than tame "stdio". OK,Theo de Raadt
there is that pesky usage message... We could tame "something" in the non-usage codepath.. but pop quiz, anyone know what happens after main returns or if exit(3) is called? atexit completion.. our atexit is very paranoid with structure management and uses mprotect. So current minimum a normal program needs is tame "malloc". tame "stdio" done before the usage codepath splits is just as good; tame placement before getopt provides a strong hint about program behaviour. I am still hoping someone comes up with a nice solution for atexit, or a nice tame subset between "" (pure computation) and "malloc". Ideas have been floated to expose "self", but it lacks mprotect also, and should continue to lack it (see the ssh tame sandbox).
2015-09-22sleep doesn't benefit from setting locale. we always want to parse numbersTed Unangst
as our forefathers did, and it doesn't print any error messages in need of translation. ok stsp
2014-05-27document SIGALRM, since it's handling is somewhat special, and useJason McIntyre
a standard EXIT STATUS blurb now that we can; ok guenther sobrado millert
2014-02-21remove section 2/3 pointers from section 1,Ingo Schwarze
and do not point programmers at the obsolete usleep(3); based on a diff from Jan Klemkow <j dot klemkow at wemelug dot de>, but removing more as suggested by jmc@ and deraadt@
2013-11-21add unsigned char casts for specific calls to ctype.h macros.Theo de Raadt
ok guenther step
2010-09-03add an EXIT STATUS section for /bin;Jason McIntyre
2010-07-22move exit returns blurb out of DIAGNOSTICS; from daniel dickmanJason McIntyre
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2009-02-13argv space does not need to be trashed during parsingTheo de Raadt
2009-02-08bump the posix reference in STANDARDS to IEEE Std 1003.1-2008, with a fewJason McIntyre
updates to follow;
2007-05-31convert to new .Dd format;Jason McIntyre
2007-05-29- consistent STANDARDS blurbJason McIntyre
- note which options are extensions to POSIX discussed w/ deraadt otto millert
2007-02-06fix some dodgy displays;Jason McIntyre
2004-09-16ARGSUSED on signal handlerTheo de Raadt
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2002-09-06KNFTheo de Raadt
2002-07-04ansiTheo de Raadt
2002-05-31Don't include cases for characters not in optstring; ericj. Snuck in on myPaul Janzen
last commit here.
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
2001-09-06o) __progname aria;Mike Pechkin
millert@ ok.
2001-05-20trade 3 exits for returnMichael Shalayeff
2000-04-12Trailing whitespace begone!Aaron Campbell
2000-02-19Improve.Aaron Campbell
2000-01-05Return EINVAL if we can't sleep for the specified time interval (i.e. it'sPaul Janzen
too long); problem noted by viha@vip.fi
1999-12-06This sleep accepts fractional timings as well.Marc Espie
Rephrase examples slightly.
1999-09-02awk -> .Xr awk 1Aaron Campbell
1998-12-15always give .Nm macros an argument in SYNOPSIS sections; krw@tcn.netAaron Campbell
1998-11-28start killing redundant .Nm macro arguments (mandoc ``remembers'' the first oneAaron Campbell
it's given)
1998-09-23alphabetize SEE ALSO entries and numerically order according to sectionAaron Campbell
1998-09-14First complete sweep of man pages, bin/. Command/function names previouslyAaron Campbell
(incorrectly) capatilized are fixed. Comma splices, hyphenations, SYNOPSIS cleanups, other miscellaneous typos.
1997-09-21$OpenBSD$Theo de Raadt
1997-09-12#include <ctype.h>Todd C. Miller
1997-08-19Note POSIX 1003.2 conformance.denny
1997-08-19POSIX 1003.2: exit w/ 0 code if receive SIGALRM.denny
1997-06-29Reject non-numeric argument (so can't use atoi).denny
1997-06-29Make sleep handle fractions of a second. Why not?denny
1997-01-15getopt(3) returns -1 when out of args, not EOF, whee!Todd C. Miller
1996-08-02zap getopt() case of -?, come on, it is the default!Theo de Raadt
1996-06-23update rcsidTheo de Raadt
1995-10-18initial import of NetBSD treeTheo de Raadt