Date: Mon, 29 Sep 1997 12:11:14 +0200 (MET DST) From: Wolfram Schneider <wosch@cs.tu-berlin.de> To: current@freebsd.org Subject: silent cp -i Message-ID: <199709291011.MAA01857@panke.panke.de>
index | next in thread | raw e-mail
cp(1) is too silent if used with the option -i. It should
print which input cp expect (y/n) and print a warning if the
file was not overwritten.
[current behavior]
$ touch from to
$ cp -i from to
overwrite to? n
[new]
$ cp -i from to
overwrite to? (y/n [n]) n
not overwritten
Index: utils.c
===================================================================
RCS file: /usr/cvs/src/bin/cp/utils.c,v
retrieving revision 1.13
diff -u -r1.13 utils.c
--- utils.c 1997/02/22 14:01:34 1.13
+++ utils.c 1997/09/28 10:38:32
@@ -81,13 +81,16 @@
* modified by the umask.)
*/
if (!dne) {
+#define YESNO "(y/n [n]) "
if (iflag) {
- (void)fprintf(stderr, "overwrite %s? ", to.p_path);
+ (void)fprintf(stderr, "overwrite %s? %s",
+ to.p_path, YESNO);
checkch = ch = getchar();
while (ch != '\n' && ch != EOF)
ch = getchar();
if (checkch != 'y' && checkch != 'Y') {
(void)close(from_fd);
+ (void)printf("not overwritten\n");
return (0);
}
}
--
Wolfram Schneider <wosch@apfel.de> http://www.apfel.de/~wosch/
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709291011.MAA01857>
