summaryrefslogtreecommitdiff
path: root/src/touch.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-08-07 22:04:37 +0000
committerJim Meyering <jim@meyering.net>2002-08-07 22:04:37 +0000
commit0a6e22bb957feb1209133da3e7c47792cf30c19c (patch)
treeb1d9f5754c5aa23cbe137e0c92411d09ad1606fb /src/touch.c
parent1f6174e4660ddaf10fdb0e2d6168a3f3dc9227ac (diff)
downloadcoreutils-0a6e22bb957feb1209133da3e7c47792cf30c19c.tar.xz
(main): Adjust to posixtime signature change.
Remove unnecessary initialization. Use localtime, not posixtm, to warn about obsolete "touch".
Diffstat (limited to 'src/touch.c')
-rw-r--r--src/touch.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/touch.c b/src/touch.c
index 9a0b81c1e..2cbe7614f 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -282,7 +282,6 @@ main (int argc, char **argv)
atexit (close_stdout);
change_times = no_create = use_ref = posix_date = flexible_date = 0;
- newtime = (time_t) -1;
while ((c = getopt_long (argc, argv, "acd:fmr:t:", longopts, NULL)) != -1)
{
@@ -321,9 +320,8 @@ main (int argc, char **argv)
case 't':
posix_date++;
- newtime = posixtime (optarg,
- PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS);
- if (newtime == (time_t) -1)
+ if (! posixtime (&newtime, optarg,
+ PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS))
error (1, 0, _("invalid date format %s"), quote (optarg));
date_set++;
break;
@@ -364,12 +362,11 @@ main (int argc, char **argv)
if (!date_set && 2 <= argc - optind && !STREQ (argv[optind - 1], "--")
&& posix2_version () < 200112)
{
- newtime = posixtime (argv[optind], PDS_TRAILING_YEAR);
- if (newtime != (time_t) -1)
+ if (posixtime (&newtime, argv[optind], PDS_TRAILING_YEAR))
{
if (! getenv ("POSIXLY_CORRECT"))
{
- struct tm const *tm = posixtm (argv[optind], PDS_TRAILING_YEAR);
+ struct tm const *tm = localtime (&newtime);
error (0, 0,
_("warning: `touch %s' is obsolete; use `touch -t %04d%02d%02d%02d%02d.%02d'"),
argv[optind],