summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-01-18 15:36:23 +0000
committerJim Meyering <jim@meyering.net>2002-01-18 15:36:23 +0000
commit1f2f9be7f828c75e70a91f04fbe5103409703e34 (patch)
tree8938d9816c0f3e9d44effe7f1bd758df90245a39 /src
parent96400fcda4088971714b0f7407a0163bb81c9dfe (diff)
downloadcoreutils-1f2f9be7f828c75e70a91f04fbe5103409703e34.tar.xz
(main): Issue a warning for obsolete usage, unless POSIXLY_CORRECT.
Diffstat (limited to 'src')
-rw-r--r--src/touch.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/touch.c b/src/touch.c
index 671a559fb..e4666f03f 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -364,6 +364,16 @@ main (int argc, char **argv)
newtime = posixtime (argv[optind], PDS_TRAILING_YEAR);
if (newtime != (time_t) -1)
{
+ if (! getenv ("POSIXLY_CORRECT"))
+ {
+ struct tm const *tm = posixtm (argv[optind], PDS_TRAILING_YEAR);
+ error (0, 0,
+ _("warning: `touch %s' is obsolete; use `touch -t %04d%02d%02d%02d%02d.%02d'"),
+ argv[optind],
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ }
+
optind++;
date_set++;
}