From ed85df444a92a64bd63e85404719df99afb7381e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 9 Feb 2009 11:44:17 +0100 Subject: touch: deprecate --file option: equivalent to --reference (-r) * src/touch.c: Mark long-undocumented --file for removal in 2010. (main): Warn upon use of --file. --- src/touch.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/touch.c') diff --git a/src/touch.c b/src/touch.c index bbc9c6012..3d6d9fac2 100644 --- a/src/touch.c +++ b/src/touch.c @@ -1,5 +1,5 @@ /* touch -- change modification and access times of files - Copyright (C) 87, 1989-1991, 1995-2005, 2007-2008 + Copyright (C) 87, 1989-1991, 1995-2005, 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -82,7 +82,7 @@ static struct option const longopts[] = {"time", required_argument, NULL, TIME_OPTION}, {"no-create", no_argument, NULL, 'c'}, {"date", required_argument, NULL, 'd'}, - {"file", required_argument, NULL, 'r'}, /* FIXME: remove --file in 2006 */ + {"file", required_argument, NULL, 'r'}, /* FIXME: remove --file in 2010 */ {"reference", required_argument, NULL, 'r'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, @@ -275,6 +275,7 @@ main (int argc, char **argv) bool date_set = false; bool ok = true; char const *flex_date = NULL; + int long_idx; /* FIXME: remove in 2010, when --file is removed */ initialize_main (&argc, &argv); set_program_name (argv[0]); @@ -287,7 +288,7 @@ main (int argc, char **argv) change_times = 0; no_create = use_ref = false; - while ((c = getopt_long (argc, argv, "acd:fmr:t:", longopts, NULL)) != -1) + while ((c = getopt_long (argc, argv, "acd:fmr:t:", longopts, &long_idx)) != -1) { switch (c) { @@ -311,6 +312,10 @@ main (int argc, char **argv) break; case 'r': + if (long_idx == 3) + error (0, 0, + _("warning: the --%s option is obsolete; use --reference"), + longopts[long_idx].name); use_ref = true; ref_file = optarg; break; -- cgit v1.2.3-54-g00ecf