summaryrefslogtreecommitdiff
path: root/src/rm.c
diff options
context:
space:
mode:
authorRasmus Villemoes <rv@rasmusvillemoes.dk>2013-07-18 21:53:12 +0000
committerPádraig Brady <P@draigBrady.com>2013-07-19 12:27:09 +0100
commitc490a6ff2b7336121428c908de1ad4ceb87f6199 (patch)
treecea64963e65a18457c4f7311c1d6f3341dee8d6e /src/rm.c
parente6fc265b755eef0eae425caec3f93b8e28dbdddb (diff)
downloadcoreutils-c490a6ff2b7336121428c908de1ad4ceb87f6199.tar.gz
rm: output number of arguments at the interactive prompt
Include the number of arguments which rm received in the "Remove all arguments?" prompt. This is useful in the, presumably, common case where the arguments were not provided by hand, but instead were the result of various shell expansions. A simple, if somewhat contrived, example (assuming rm is aliased to rm -I) could be: rm * .o where the prompt "Remove 120 arguments?" is more likely to make the user catch the problem. * src/rm.c (main): Include correctly pluralized n_files in the output message. Also remove the now redudant "all". * tests/rm/interactive-always.sh: Adjust to the new prompt. * tests/rm/interactive-once.sh: Likewise.
Diffstat (limited to 'src/rm.c')
-rw-r--r--src/rm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/rm.c b/src/rm.c
index 3e187cf80..b9b84e117 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -339,9 +339,13 @@ main (int argc, char **argv)
{
fprintf (stderr,
(x.recursive
- ? _("%s: remove all arguments recursively? ")
- : _("%s: remove all arguments? ")),
- program_name);
+ ? ngettext ("%s: remove %zu argument recursively? ",
+ "%s: remove %zu arguments recursively? ",
+ select_plural (n_files))
+ : ngettext ("%s: remove %zu argument? ",
+ "%s: remove %zu arguments? ",
+ select_plural (n_files))),
+ program_name, n_files);
if (!yesno ())
exit (EXIT_SUCCESS);
}