]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Include posixtm.h.
authorJim Meyering <jim@meyering.net>
Mon, 7 Sep 1998 02:35:31 +0000 (02:35 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 7 Sep 1998 02:35:31 +0000 (02:35 +0000)
(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

index 2f11b34fc3e825f3022b1aaafd754878cb446be8..ad0a708e4a837c9c126dac3461773929efbdbf26 100644 (file)
 #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++;