mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-03-06 13:05:04 +02:00
(main): Issue a warning for obsolete usage, unless POSIXLY_CORRECT.
This commit is contained in:
10
src/touch.c
10
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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user