coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] rm: Add number of arguments to interactive prompt


From: Bernhard Voelker
Subject: Re: [PATCH] rm: Add number of arguments to interactive prompt
Date: Fri, 19 Jul 2013 14:14:08 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

On 07/19/2013 12:40 PM, Pádraig Brady wrote:
> commit a6182978d570c65d7d89dd8306e15fe6fb59dfee
> Author: Rasmus Villemoes <address@hidden>
> Date:   Thu Jul 18 21:53:12 2013 +0000
> 
>     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 all 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".

s/redudant/redundant/

> diff --git a/src/rm.c b/src/rm.c
> index 3e187cf..b9b84e1 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))),

The select_plural() call is not needed in the latter case
because we are in this if-clause:

 if (prompt_once && (x.recursive || 3 < n_files))

i.e. it can not happen with 1 single file.

Have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]