From c0385fb129d16ebf0b9655cf77a0a8ed4a2968b1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 7 Sep 1998 02:35:31 +0000 Subject: [PATCH] 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. --- src/touch.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/touch.c b/src/touch.c index 2f11b34fc3..ad0a708e4a 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 .")); 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++; -- 2.47.3