Re: [hackers] [sbase][PATCH 2/2] cp, mv, rm: Add `-i` for confirmation prompts

From: Santtu Lakkala <inz_AT_inz.fi>
Date: Fri, 25 Nov 2022 15:16:26 +0200

On 19.11.2022 23.46, Alan Potteiger wrote:
> diff --git a/mv.c b/mv.c
> index 8441f9c..51efde5 100644
> --- a/mv.c
> +++ b/mv.c
> _AT_@ -49,6 +57,9 @@ main(int argc, char *argv[])
> ARGBEGIN {
> case 'f':
> break;
> + case 'i':
> + mv_iflag = 1;
> + break;
> default:
> usage();
> } ARGEND
> diff --git a/rm.c b/rm.c
> index 8bebfcb..70da082 100644
> --- a/rm.c
> +++ b/rm.c
> _AT_@ -19,6 +19,9 @@ main(int argc, char *argv[])
> case 'f':
> r.flags |= SILENT;
> break;
> + case 'i':
> + rm_iflag = 1;
> + break;
> case 'R':
> case 'r':
> r.maxdepth = 0;

The POSIX specification says that for mv[0] and rm[1], -f and -i cancel
each other out, with the last taking effect.

[0]: https://pubs.opengroup.org/onlinepubs/009604599/utilities/mv.html
[1]: https://pubs.opengroup.org/onlinepubs/009604599/utilities/rm.html

-- 
Santtu
Received on Fri Nov 25 2022 - 14:16:26 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 25 2022 - 14:24:30 CET