Commit Graph

87 Commits

Author SHA1 Message Date
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
ginsbach 84b3179a34 Adapt date(1), the netsettime function, to new return value from socket(2)
when the address family is unsupported.
2006-06-14 16:35:16 +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
lukem f994b2252e doc2html works here now, so remove NOHTML 2003-07-18 02:18:57 +00:00
itojun 032ed69f9a strlcpy 2003-07-12 13:23:55 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
wiz 14dfaa4b03 New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
2002-09-25 15:18:36 +00:00
mycroft 826e316675 select() -> poll() 2002-09-21 18:15:57 +00:00
ross dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
wiz 22f1ac50a6 Sort sections. 2001-12-20 20:04:19 +00:00
wiz 3ebcdc5e43 Whitespace nits. 2001-12-20 19:31:48 +00:00
lukem cc76cf8530 fix WARNS=2 2001-11-03 13:08:16 +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 bad387a59a Use socklen_t; for compilers with strict type checking. 2001-07-08 05:26:03 +00:00
gmcgarry 91825c128d setthetime() is prototyped static; make it so. 2001-07-08 05:24:50 +00:00
lukem 17c6a1082e doc2hmtl is broken for recursive Oo ... Oc at this time 2001-07-03 21:50:13 +00:00
hubertf bb6b8354d9 xref settimeofday(2) 2001-03-09 15:16:49 +00:00
hubertf 84a116117c Document /etc/localtime, per PR 8099 by Charles Hannum. 2000-12-18 07:57:02 +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 080f6953ea Formatting cleanup: more fonts, less punctuation. 2000-10-08 11:02:41 +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
hubertf 6f51bb4732 make example cut&paste-ready 1999-12-29 04:11:30 +00:00
ross 6fe4eb2696 Work around a spurious warning. 1999-03-09 03:02:40 +00:00
kristerw c6d1478acf Fixed off-by-one error where HOSTNAME+1 characters was copied into
tsp_name that has size HOSTNAME.
1998-12-19 22:44:19 +00:00
christos ab0eebb3f6 cast to unsigned char for is*() 1998-11-04 12:51:00 +00:00
christos 6e381b4c96 #ifdef BSD4_4 for sin_len 1998-11-04 12:50:17 +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 ce7d757530 Delint. 1998-07-28 03:47:14 +00:00
mycroft dbfa4f81b0 __AUDIT__ cleanup. 1998-07-27 16:43:25 +00:00
mrg 2beab49a06 - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
1998-07-06 06:45:41 +00:00
lukem a7881b9570 remove unnecessary comment 1998-06-08 09:07:13 +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 0166097d26 Fix documentation of `-r'. 1998-01-20 21:34:53 +00:00