summaryrefslogtreecommitdiff
path: root/src/touch.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-02-09 11:44:17 +0100
committerJim Meyering <meyering@redhat.com>2009-02-09 11:44:40 +0100
commited85df444a92a64bd63e85404719df99afb7381e (patch)
tree3d8f724b6d8868003436317e25dd1005de643b3e /src/touch.c
parent0dc4478f130e08b8a2909b6830654a1be98d7915 (diff)
downloadcoreutils-ed85df444a92a64bd63e85404719df99afb7381e.tar.xz
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.
Diffstat (limited to 'src/touch.c')
-rw-r--r--src/touch.c11
1 files changed, 8 insertions, 3 deletions
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;