mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
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.
This commit is contained in:
11
src/touch.c
11
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;
|
||||
|
||||
Reference in New Issue
Block a user