Commit Graph

41 Commits

Author SHA1 Message Date
jilles
0af45322c0 touch: Add the -d option from POSIX.1-2008.
This is much like -t but with a different format which is ISO8601-like and
allows fractions of a second.

The precision is limited to microseconds because of utimes() and friends,
even though stat() returns nanoseconds.

MFC after:	10 days
2012-06-10 14:26:51 +00:00
eadler
1ef5fe44d3 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
jh
95784fde40 Remove useless and potentially dangerous rw() function which tries to
update access and modification times by reading and writing the file.
chmod(2) in rw() doesn't help because utimes(2) allow owner and the
super-user to change times. Using just utimes(2) should be sufficient.

The -f option becomes no-op.

Reviewed by:	jilles
2012-02-04 13:37:31 +00:00
joel
29af67e52c Remove the advertising clause from UCB copyrighted files in usr.bin. This
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
2010-12-11 08:32:16 +00:00
ed
543b5e901b Change all our own code to use st_*tim instead of st_*timespec.
Also remove some local patches to diff(1) which are now unneeded.
2010-03-28 13:16:08 +00:00
jh
f1d2f78466 - If lstat()/stat() fails with an error other than ENOENT, don't ignore
the error and assume that the file doesn't exist. Touch could return
  success with -c option even if the file existed and time was not set.
- If the first utimes_f() call fails with -A option, give up and don't
  continue trying to set times to current time. [1]
- Set exit status to 1 when setting of timestamps fails for a directory
  or symbolic link even though lstat()/stat() would succeed.
- Don't print bogus error message when rw() succeeds.

PR:		bin/112213
Submitted by:	jilles [1]
Reviewed by:	jilles
Approved by:	trasz (mentor)
2009-10-16 20:52:45 +00:00
grog
0a7f1377cf Update to match revision 1.23 of touch.c.
Clarify some details.
2007-04-10 07:24:47 +00:00
grog
4035199a7c Usage: print base name of program.
-A flag: respect the -a and -m flags.
	 imply the -c flag.

Requested in principle by: brian
2007-04-10 07:22:30 +00:00
grog
5218e59269 Add -A flag to adjust existing time stamps.
Print name by which program was started in usage() message.

MFC after:  2 weeks
2007-04-09 02:19:37 +00:00
ache
ad0b0bb8d9 Don't set time to current, if set to specific time fails
PR:             92577
2006-01-31 02:21:18 +00:00
ru
1541af42f1 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
ru
7f3c7f0d46 Sort sections. 2005-01-18 13:43:56 +00:00
ru
6cc4b6c220 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
dwmalone
b4339b74ad ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
charnier
7dd9d47059 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:23:09 +00:00
jmallett
2b6e4e1504 Remove local prototypes for main(). 2002-08-19 03:07:56 +00:00
eric
7ff3e005dc Handle directories correctly.
PR:		40801
MFC after:	5 days
2002-07-23 04:54:57 +00:00
imp
0b20191705 remove __P 2002-03-22 01:42:45 +00:00
markm
832832ca4c WARNS=2 is going to be the default, so don't specify it. Use __FBSDID(). 2001-12-11 23:38:24 +00:00
obrien
46f886d612 Clarify that -h implies -c. 2001-09-24 17:42:37 +00:00
obrien
b543286930 blah, remove debugging code that crept in with last commit. 2001-09-23 00:11:48 +00:00
obrien
a2ccfc7be5 Add the 'h' flag to operate on symlinks rather than what they point to. 2001-09-22 18:45:03 +00:00
ru
bde8ec1b70 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
kris
ddc5c05478 Fix some trivial warnings and clamp down with WARNS=2
MFC after:	1 week
2001-05-26 22:39:33 +00:00
ru
0d1334ca0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
charnier
42d5955dc9 Add DIAGNOSTICS section name 2000-03-26 15:06:46 +00:00
peter
3b842d34e8 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
nik
6578739ddb Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:24:20 +00:00
billf
4822432874 Clean up some ambiguous nested if/elses. 1999-07-04 17:26:16 +00:00
des
6e433d5ab6 Brucify. 1999-05-12 06:57:07 +00:00
des
921d0267c5 Sync usage() with man page.
PR:		11539
Submitted by:	Ruslan Ermilov <ru@ucb.crimea.ua>
1999-05-11 14:23:16 +00:00
danny
7244b9f847 Merge from 2_2 man page change. 1999-01-05 10:13:54 +00:00
danny
b99ec91e28 PR: 9323
Submitted by:	ishisone@sra.co.jp
Make touch handle years 2000-2038 in the obsoleted format, rather
than 1902-1969 as was previously the case with two digit year spec.
1999-01-05 09:58:02 +00:00
bde
d1ade19b07 Don't assume that time_t is long. 1998-06-29 15:52:49 +00:00
charnier
5e2454839f Cosmetic. 1997-08-18 07:22:53 +00:00
imp
141381e1cb compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
bde
6ed5ccfb8f Don't use __dead or __pure in user code. They were obfuscations
for gcc >= 2.5 and no-ops for gcc >= 2.6.  Converted to use __dead2
or __pure2 where it wasn't already done, except in math.h where use
of __pure was mostly wrong.
1996-09-14 03:00:32 +00:00
adam
99c3be59a5 YY --> CC 1996-09-10 21:19:56 +00:00
joerg
674a6f7eba PR # bin/274
> The command:
>
> touch -t 199504011200 testfile
>
> gives the error message:
>
> touch: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]

Submitted by:	mpp@legarto.minn.net (Mike Pritchard)
1995-07-08 16:47:47 +00:00
rgrimes
a14d555c87 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
rgrimes
f9ab90d9d6 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00