From 1f2f9be7f828c75e70a91f04fbe5103409703e34 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 18 Jan 2002 15:36:23 +0000 Subject: (main): Issue a warning for obsolete usage, unless POSIXLY_CORRECT. --- src/touch.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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++; } -- cgit v1.2.3-54-g00ecf