summaryrefslogtreecommitdiffstats
path: root/bin/mv/mv.c
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1997-10-04 13:02:06 +0000
committerwosch <wosch@FreeBSD.org>1997-10-04 13:02:06 +0000
commit05cceede385634c093dbc9e42315aed6f2ae2b8d (patch)
tree3fd19c4a724ca2811e1342121d2d993a05ecbc03 /bin/mv/mv.c
parente772f46053a59b9d0daa941ad34bb1f407431d33 (diff)
downloadFreeBSD-src-05cceede385634c093dbc9e42315aed6f2ae2b8d.zip
FreeBSD-src-05cceede385634c093dbc9e42315aed6f2ae2b8d.tar.gz
mv(1) is too silent if used with the option -i. It should
print which input mv(1) expect (y/n) and print a warning if the file was not overwritten.
Diffstat (limited to 'bin/mv/mv.c')
-rw-r--r--bin/mv/mv.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index 96d62a1..a2dc324 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mv.c,v 1.13 1997/03/28 15:24:26 imp Exp $
+ * $Id: mv.c,v 1.14 1997/09/28 10:41:40 wosch Exp $
*/
#ifndef lint
@@ -157,25 +157,28 @@ do_move(from, to)
warn("%s", from);
return (1);
}
-
+
+#define YESNO "(y/n [n]) "
ask = 0;
if (iflg) {
- (void)fprintf(stderr, "overwrite %s? ", to);
+ (void)fprintf(stderr, "overwrite %s? %s", to, YESNO);
ask = 1;
} else if (access(to, W_OK) && !stat(to, &sb)) {
strmode(sb.st_mode, modep);
- (void)fprintf(stderr, "override %s%s%s/%s for %s? ",
+ (void)fprintf(stderr, "override %s%s%s/%s for %s? %s",
modep + 1, modep[9] == ' ' ? "" : " ",
user_from_uid(sb.st_uid, 0),
- group_from_gid(sb.st_gid, 0), to);
+ group_from_gid(sb.st_gid, 0), to, YESNO);
ask = 1;
}
if (ask) {
first = ch = getchar();
while (ch != '\n' && ch != EOF)
ch = getchar();
- if (first != 'y' && first != 'Y')
+ if (first != 'y' && first != 'Y') {
+ (void)fprintf(stderr, "not overwritten\n");
return (0);
+ }
}
}
if (!rename(from, to))
OpenPOWER on IntegriCloud