From dfd403c8d24e881d09703a580cb6a3c8d257adf3 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 23 Aug 2020 22:50:16 -0500 Subject: Peter McConalogue pointed out that cp/mv -i prompt should default N. Also, the failing mv test was because posix says to prompt when mv-ing over an unwriteable file only when stdin is a tty (but -i prompts either way) --- toys/posix/cp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys') diff --git a/toys/posix/cp.c b/toys/posix/cp.c index fd893ef4..09e5701f 100644 --- a/toys/posix/cp.c +++ b/toys/posix/cp.c @@ -166,7 +166,7 @@ static int cp_node(struct dirtree *try) fprintf(stderr, "%s: overwrite '%s'", toys.which->name, s = dirtree_path(try, 0)); free(s); - if (!yesno(1)) return 0; + if (!yesno(0)) return 0; } } @@ -434,7 +434,7 @@ void cp_main(void) // _else_) but I don't care. if (exists && (FLAG(i) || !(st.st_mode & 0222))) { fprintf(stderr, "%s: overwrite '%s'", toys.which->name, TT.destname); - if (!yesno(1)) rc = 0; + if (!yesno(0)) rc = 0; else unlink(TT.destname); } // if -n and dest exists, don't try to rename() or copy -- cgit v1.2.3