summaryrefslogtreecommitdiff
path: root/src/remove.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-01-17 17:02:40 +0100
committerJim Meyering <jim@meyering.net>2007-01-17 17:15:20 +0100
commit0928c2414ab21682600e6572bc628a405fb1ea80 (patch)
treeff030e34af21eb8a8252af6773e54848e18df05b /src/remove.c
parentd1ad73e0bf6a1b6c62e424c1f28cf344fca10600 (diff)
downloadcoreutils-0928c2414ab21682600e6572bc628a405fb1ea80.tar.xz
Make "rm --interactive=never ..." never prompt.
* NEWS: Mention this. * src/remove.h (enum rm_interactive): New ternary type. (struct rm_options) [interactive]: Use it, here -- rather than bool. * src/remove.c (prompt): Reflect type change. * src/mv.c (rm_option_init): Initialize to RMI_NEVER now. * src/rm.c (main): Add a FIXME comment for '-d' option. Adapt to type change of rm_options.interactive. * tests/rm/i-never: New file. Test for the above fix. * tests/rm/Makefile.am (TESTS): Add i-never.
Diffstat (limited to 'src/remove.c')
-rw-r--r--src/remove.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/remove.c b/src/remove.c
index fbe720456..97184eb26 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -798,10 +798,14 @@ prompt (int fd_cwd, Dirstack_state const *ds, char const *filename,
*is_empty = T_UNKNOWN;
- if (((!x->ignore_missing_files & (x->interactive | x->stdin_tty))
+ if (x->interactive == RMI_NEVER)
+ return RM_OK;
+
+ if (((!x->ignore_missing_files & ((x->interactive == RMI_ALWAYS)
+ | x->stdin_tty))
&& (write_protected = write_protected_non_symlink (fd_cwd, filename,
ds, sbuf)))
- || x->interactive)
+ || x->interactive == RMI_ALWAYS)
{
if (cache_fstatat (fd_cwd, filename, sbuf, AT_SYMLINK_NOFOLLOW) != 0)
{
@@ -821,7 +825,7 @@ prompt (int fd_cwd, Dirstack_state const *ds, char const *filename,
/* Using permissions doesn't make sense for symlinks. */
if (S_ISLNK (sbuf->st_mode))
{
- if ( ! x->interactive)
+ if (x->interactive != RMI_ALWAYS)
return RM_OK;
write_protected = false;
}