summaryrefslogtreecommitdiff
path: root/src/touch.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-09-07 02:35:31 +0000
committerJim Meyering <jim@meyering.net>1998-09-07 02:35:31 +0000
commitc0385fb129d16ebf0b9655cf77a0a8ed4a2968b1 (patch)
tree1b479c26273df449cbbbf271a2b486961f748a36 /src/touch.c
parentac88b78ef39fdcb0c00311a6d70b857369a8c797 (diff)
downloadcoreutils-c0385fb129d16ebf0b9655cf77a0a8ed4a2968b1.tar.xz
Include posixtm.h.
(usage): Correct the description of the format of the date string argument to -t option. (main): Update to use rewritten posixtime function. Reported by Andries Brouwer.
Diffstat (limited to 'src/touch.c')
-rw-r--r--src/touch.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/touch.c b/src/touch.c
index 2f11b34fc..ad0a708e4 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -29,12 +29,12 @@
#include "argmatch.h"
#include "getdate.h"
#include "safe-read.h"
+#include "posixtm.h"
#ifndef STDC_HEADERS
time_t time ();
#endif
-time_t posixtime ();
int full_write ();
void invalid_arg ();
@@ -200,6 +200,8 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... FILE...\n"), program_name);
+ printf (_(" or : %s [-acm] MMDDhhmm[YY] FILE... (obsolescent)\n"),
+ program_name);
printf (_("\
Update the access and modification times of each FILE to the current time.\n\
\n\
@@ -209,12 +211,14 @@ Update the access and modification times of each FILE to the current time.\n\
-f (ignored)\n\
-m change only the modification time\n\
-r, --reference=FILE use this file's times instead of current time\n\
- -t STAMP use MMDDhhmm[[CC]YY][.ss] instead of current time\n\
+ -t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time\n\
--time=WORD access -a, atime -a, mtime -m, modify -m, use -a\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
STAMP may be used without -t if none of -drt, nor --, are used.\n\
+Note that the three time-date formats recognized for the -d and -t options\n\
+and for the obsolescent argument are all different.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
@@ -274,7 +278,8 @@ main (int argc, char **argv)
case 't':
posix_date++;
- newtime = posixtime (optarg);
+ newtime = posixtime (optarg,
+ PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS);
if (newtime == (time_t) -1)
error (1, 0, _("invalid date format `%s'"), optarg);
date_set++;
@@ -324,7 +329,7 @@ main (int argc, char **argv)
if (!date_set && optind < argc && !STREQ (argv[optind - 1], "--"))
{
- newtime = posixtime (argv[optind]);
+ newtime = posixtime (argv[optind], PDS_TRAILING_YEAR);
if (newtime != (time_t) -1)
{
optind++;