From 0928c2414ab21682600e6572bc628a405fb1ea80 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 17 Jan 2007 17:02:40 +0100 Subject: 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. --- src/remove.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/remove.c') 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; } -- cgit v1.2.3-54-g00ecf