mirror of
https://github.com/coreutils/coreutils.git
synced 2024-11-24 10:23:31 +08:00
cp, mv: remove 3-year-deprecated+warned-about --reply option
* src/cp.c (reply_args, reply_vals): Remove globals. [REPLY_OPTION]: Remove enum. (long_opts) ["reply"]: Remove initializer. (main): Remove case stmt. * src/mv.c: Likewise. Don't include "argmatch.h". No longer used. * NEWS (Changes in behavior): Mention this. * tests/Makefile.am (TESTS): Remove mv/reply-no. * tests/mv/reply-no: Remove file. * tests/mv/i-link-no: Update, now that --reply= is gone.
This commit is contained in:
parent
aa2617b908
commit
7ef56a26fd
3
NEWS
3
NEWS
@ -19,6 +19,9 @@ GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
cp and mv: the --reply={yes,no,query} option has been removed.
|
||||
Using it has elicited a warning for the last three years.
|
||||
|
||||
ls -l now marks SELinux-only files with the less obtrusive '.',
|
||||
rather than '+'. A file with any other combination of MAC and ACL
|
||||
is still marked with a '+'.
|
||||
|
22
src/cp.c
22
src/cp.c
@ -76,7 +76,6 @@ enum
|
||||
NO_PRESERVE_ATTRIBUTES_OPTION,
|
||||
PARENTS_OPTION,
|
||||
PRESERVE_ATTRIBUTES_OPTION,
|
||||
REPLY_OPTION,
|
||||
SPARSE_OPTION,
|
||||
STRIP_TRAILING_SLASHES_OPTION,
|
||||
UNLINK_DEST_BEFORE_OPENING
|
||||
@ -108,18 +107,6 @@ static enum Sparse_type const sparse_type[] =
|
||||
};
|
||||
ARGMATCH_VERIFY (sparse_type_string, sparse_type);
|
||||
|
||||
/* Valid arguments to the `--reply' option. */
|
||||
static char const* const reply_args[] =
|
||||
{
|
||||
"yes", "no", "query", NULL
|
||||
};
|
||||
/* The values that correspond to the above strings. */
|
||||
static int const reply_vals[] =
|
||||
{
|
||||
I_ALWAYS_YES, I_ALWAYS_NO, I_ASK_USER
|
||||
};
|
||||
ARGMATCH_VERIFY (reply_args, reply_vals);
|
||||
|
||||
static struct option const long_opts[] =
|
||||
{
|
||||
{"archive", no_argument, NULL, 'a'},
|
||||
@ -138,8 +125,6 @@ static struct option const long_opts[] =
|
||||
{"preserve", optional_argument, NULL, PRESERVE_ATTRIBUTES_OPTION},
|
||||
{"recursive", no_argument, NULL, 'R'},
|
||||
{"remove-destination", no_argument, NULL, UNLINK_DEST_BEFORE_OPENING},
|
||||
{"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03,
|
||||
remove in 2008. */
|
||||
{"sparse", required_argument, NULL, SPARSE_OPTION},
|
||||
{"strip-trailing-slashes", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
|
||||
{"suffix", required_argument, NULL, 'S'},
|
||||
@ -1001,13 +986,6 @@ main (int argc, char **argv)
|
||||
x.recursive = true;
|
||||
break;
|
||||
|
||||
case REPLY_OPTION: /* Deprecated */
|
||||
x.interactive = XARGMATCH ("--reply", optarg,
|
||||
reply_args, reply_vals);
|
||||
error (0, 0,
|
||||
_("the --reply option is deprecated; use -i or -f instead"));
|
||||
break;
|
||||
|
||||
case UNLINK_DEST_BEFORE_OPENING:
|
||||
x.unlink_dest_before_opening = true;
|
||||
break;
|
||||
|
24
src/mv.c
24
src/mv.c
@ -24,7 +24,6 @@
|
||||
#include <selinux/selinux.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "argmatch.h"
|
||||
#include "backupfile.h"
|
||||
#include "copy.h"
|
||||
#include "cp-hash.h"
|
||||
@ -52,33 +51,18 @@
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
REPLY_OPTION = CHAR_MAX + 1,
|
||||
STRIP_TRAILING_SLASHES_OPTION
|
||||
STRIP_TRAILING_SLASHES_OPTION = CHAR_MAX + 1
|
||||
};
|
||||
|
||||
/* Remove any trailing slashes from each SOURCE argument. */
|
||||
static bool remove_trailing_slashes;
|
||||
|
||||
/* Valid arguments to the `--reply' option. */
|
||||
static char const* const reply_args[] =
|
||||
{
|
||||
"yes", "no", "query", NULL
|
||||
};
|
||||
|
||||
/* The values that correspond to the above strings. */
|
||||
static int const reply_vals[] =
|
||||
{
|
||||
I_ALWAYS_YES, I_ALWAYS_NO, I_ASK_USER
|
||||
};
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"backup", optional_argument, NULL, 'b'},
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"interactive", no_argument, NULL, 'i'},
|
||||
{"no-target-directory", no_argument, NULL, 'T'},
|
||||
{"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03,
|
||||
remove in 2008. */
|
||||
{"strip-trailing-slashes", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
|
||||
{"suffix", required_argument, NULL, 'S'},
|
||||
{"target-directory", required_argument, NULL, 't'},
|
||||
@ -390,12 +374,6 @@ main (int argc, char **argv)
|
||||
case 'i':
|
||||
x.interactive = I_ASK_USER;
|
||||
break;
|
||||
case REPLY_OPTION: /* Deprecated */
|
||||
x.interactive = XARGMATCH ("--reply", optarg,
|
||||
reply_args, reply_vals);
|
||||
error (0, 0,
|
||||
_("the --reply option is deprecated; use -i or -f instead"));
|
||||
break;
|
||||
case STRIP_TRAILING_SLASHES_OPTION:
|
||||
remove_trailing_slashes = true;
|
||||
break;
|
||||
|
@ -386,7 +386,6 @@ TESTS = \
|
||||
mv/part-symlink \
|
||||
mv/partition-perm \
|
||||
mv/perm-1 \
|
||||
mv/reply-no \
|
||||
mv/to-symlink \
|
||||
mv/trailing-slash \
|
||||
mv/update \
|
||||
|
@ -29,19 +29,16 @@ ln a/foo a/bar || framework_failure
|
||||
echo FUBAR > b/FUBAR || framework_failure
|
||||
ln b/FUBAR b/bar || framework_failure
|
||||
chmod a-w b/bar || framework_failure
|
||||
echo n > no || framework_failure
|
||||
|
||||
fail=0
|
||||
|
||||
mv --reply=no a/bar a/foo b > out 2> err || fail=1
|
||||
cat <<EOF > exp
|
||||
EOF
|
||||
mv a/bar a/foo b < no > out 2> err || fail=1
|
||||
touch exp
|
||||
touch exp_err
|
||||
|
||||
cat <<EOF > exp_err
|
||||
mv: the --reply option is deprecated; use -i or -f instead
|
||||
EOF
|
||||
|
||||
compare err exp_err || fail=1
|
||||
compare out exp || fail=1
|
||||
compare err exp_err || fail=1
|
||||
|
||||
case "`cat b/foo`" in
|
||||
foo) ;;
|
||||
|
@ -1,42 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Ensure that `mv --reply=no f1 f2' works.
|
||||
|
||||
# Copyright (C) 2005-2008 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
mv --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
|
||||
touch a b || framework_failure
|
||||
|
||||
fail=0
|
||||
|
||||
mv --interactive --reply=no a b > out 2>&1 || fail=1
|
||||
|
||||
# Both files must remain.
|
||||
test -f a || fail=1
|
||||
test -f b || fail=1
|
||||
|
||||
cat <<EOF > exp_err
|
||||
mv: the --reply option is deprecated; use -i or -f instead
|
||||
EOF
|
||||
|
||||
compare out exp_err || fail=1
|
||||
|
||||
Exit $fail
|
Loading…
Reference in New Issue
Block a user