cp(1) is too silent if used with the option -i. It should

print which input cp(1) expect (y/n) and print a warning if the
file was not overwritten.
This commit is contained in:
Wolfram Schneider 1997-10-03 18:11:14 +00:00
parent bd00bedcd6
commit ab215c6703
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30088

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: utils.c,v 1.13 1997/02/22 14:01:34 peter Exp $
*/
#ifndef lint
@ -81,13 +81,16 @@ copy_file(entp, dne)
* 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)fprintf(stderr, "not overwritten\n");
return (0);
}
}