dholland
33586bcc4e
Provide real error messages.
...
Inspired by PR 49169 from David H. Gutteridge, but a much broader patch :-)
2014-09-01 21:42:21 +00:00
joerg
aa6d7bb577
Annotate dead functions
2011-08-27 12:55:09 +00:00
christos
60c10f9b2e
revert the revert and fix the code properly.
2011-01-29 02:16:52 +00:00
drochner
da4141bdd5
roll back to 20101210 -- the current version just hung if one tried
...
to set the date
2011-01-28 20:23:38 +00:00
christos
187cac5a8d
check return value of localtime.
2010-12-12 17:30:23 +00:00
christos
5b87ff3a6f
- check return of strtoll
...
- misc cleanup
2010-12-11 16:57:51 +00:00
gson
10d3698a9d
Simplify by using setenv() instead of putenv().
2010-10-03 08:21:27 +00:00
gson
5e313b3092
putenv() no longer accepts a const string
2010-10-02 08:26:09 +00:00
dholland
a617f5fd5a
Don't blow up on date +''. Patch from Robert Elz in followup to PR 39392.
2010-05-29 20:41:58 +00:00
lukem
2fe2731d3f
Remove the \n and tabs from the __COPYRIGHT() strings.
2008-07-20 00:52:39 +00:00
dholland
6dc3dcbc38
Use strtoll rather than strtol to read the -r argument, so it will work
...
for wider time_t. Also mark a timed-related y2038 lossage for whenever
someone figures out the best way to shoot timed.
2008-02-24 04:49:45 +00:00
cbiere
1b1ee3c7ce
Use size_t not int for strlen().
2007-02-04 22:11:13 +00:00
christos
ab56b9a702
getdate -> parsedate
2006-11-20 20:33:33 +00:00
christos
c8226bf504
getdate is in libutil.
2006-11-17 22:11:28 +00:00
christos
aa62ece776
Add -d option, similar to gnu date.
2006-11-15 16:55:18 +00:00
jdarrow
5d27a9d665
Add -j flag to not actually change the clock, just parse the date given
...
(if any) and then display it in the format given. Matches similar -j
flag functionality in FreeBSD/OpenBSD.
Change requested by George Georgalis on netbsd-users.
While I'm here, disambiguate the letters in the date string, by using
the same option letters as used by strftime(3).
2006-11-15 03:10:01 +00:00
elad
9b5118f13d
PR/28450: David H. Gutteridge: date(1) does not validate its input and
...
accepts and processes impossible dates
Patch applied, thanks!
2006-10-07 09:34:46 +00:00
jnemeth
a0cb2a839d
don't include program name when calling err()
2006-08-17 10:03:53 +00:00
christos
8a487b533d
PR/34055: Kevin Massey: Date uses a fixed 1K buffer for strftime
...
but does not check when strftime fails because the buffer is too small.
Our implementation of strftime does not NUL terminat the buffer
on failure (it does not have to; the results are undefined), so
garbage gets printed. Use a dynamically allocated buffer instead.
2006-07-23 20:39:10 +00:00
peter
fa141339e0
More minor cleanup:
...
- remove unnecessary prototype for main()
- use symbolic exit code
- KNF & wrap a long line
2005-07-22 14:27:08 +00:00
hubertf
15bc25dc45
Minor code cleanup:
...
* remove unneeded cast
* use err() instead of perror() + exit()
* use symbolic exit code
Patch contributed by Liam J. Foy <liamfoy@sepulcrum.org> in private mail.
2005-07-22 11:06:24 +00:00
christos
6310b59691
sprinkle a little const, and now everything compiles with WARNS=3
2005-06-26 19:10:48 +00:00
dsl
d85801918d
Set (and report) the new time (not the old one).
...
I broke it in rev 1.38, someone has finally noticed....
2005-05-15 18:39:39 +00:00
dsl
a7151c0abc
Add a '-a' option to set the time using adjtime(2) instead of settimeofday(2).
...
Fix usage so that the options which apply to dat/time setting are on the
correct line.
2005-04-18 06:53:35 +00:00
agc
b5b2954259
Move UCB-licensed code from 4-clause to 3-clause licence.
...
Patches provided by Joel Baker in PR 22249, verified by myself.
2003-08-07 09:05:01 +00:00
jschauma
458ed23412
As discusses a little while back on tech-userlevel:
...
If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.
While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
2003-08-04 22:31:21 +00:00
wiz
bb88f10d3d
Use setprogname. Patch by Petri Koistinen.
2001-09-16 13:35:52 +00:00
wiz
a824cb6a27
ANSIfication and KNF fixes by Petri Koistinen in bin/13691.
2001-09-13 10:06:40 +00:00
gmcgarry
91825c128d
setthetime() is prototyped static; make it so.
2001-07-08 05:24:50 +00:00
simonb
1f68c34537
Use strtol() to convert the -r parameter so we can use alternate bases
...
for that input.
2000-10-23 02:43:52 +00:00
bjh21
a17ce6ad1e
When setting the date, ask mktime() to work out whether we're in DST or not.
...
Seems to fix PR bin/8750.
2000-10-08 10:30:44 +00:00
simonb
51ee9dc68d
Don't declare 'extern opt*' getopt variables.
2000-04-14 05:52:56 +00:00
kleink
c5d7701cd4
Make this slightly more portable by using putenv().
2000-01-04 14:15:09 +00:00
christos
ab0eebb3f6
cast to unsigned char for is*()
1998-11-04 12:51:00 +00:00
mycroft
d32f290dae
GMT -> UTC
1998-10-24 03:45:51 +00:00
wsanchez
1b845eea1b
For the case where mktime() fails exit with "illegal time" error rather than
...
"illegal time format", which is misleading.
1998-10-14 00:49:44 +00:00
mycroft
ee9e50eacb
Be more retentive about use of NOTREACHED and noreturn.
1998-07-28 11:41:40 +00:00
mycroft
9dc385beb1
Delint.
1998-07-28 05:31:22 +00:00
mycroft
dbfa4f81b0
__AUDIT__ cleanup.
1998-07-27 16:43:25 +00:00
kleink
314d411687
Need <time.h> for time(), strftime(), localtime() and mktime() prototypes.
1998-04-01 13:54:44 +00:00
mycroft
65139bd9be
Slight code rearrangement.
1998-01-21 00:07:44 +00:00
mycroft
76b3c10513
Don't validate the mmddhhmm.ss values here. mktime(3) does it.
1998-01-20 22:06:02 +00:00
mycroft
c7273dc993
Make the documented parsing order for the date match reality.
1998-01-20 21:47:43 +00:00
mycroft
f9a6471ec7
Allow a century to be specified.
...
Cut and paste some text from touch(1) about date parsing.
1998-01-20 21:16:38 +00:00
mycroft
eeec814a41
Use TM_YEAR_BASE to adjust tm_year, not 1900.
1998-01-20 20:53:32 +00:00
cgd
bad15fd37f
lint
1997-11-05 21:17:14 +00:00
thorpej
a71a8b8761
__RCSID()/__COPYRIGHT()/prototype police.
1997-07-20 05:17:33 +00:00
cgd
4274523efe
pull in util.h rather than prototypeing logtwmp() locally.
1997-03-26 20:28:11 +00:00
perry
61974fdce1
remove obsolete -d and -t options -- kernel timezone handling is long gone
1997-01-24 18:17:17 +00:00
tls
3811362c9a
kill use of register
1997-01-09 16:31:05 +00:00