diff options
author | johan <johan@FreeBSD.org> | 2002-07-23 00:42:56 +0000 |
---|---|---|
committer | johan <johan@FreeBSD.org> | 2002-07-23 00:42:56 +0000 |
commit | c464bca234e43e5c9d7076042f3261ce368fbc4e (patch) | |
tree | 49671495a38f4cacd1e75c9f73f7e469e9ee79ec /bin/cp/utils.c | |
parent | 7bd1d4e8de5727f9c13675ff5ab143c5dd5bb66e (diff) | |
download | FreeBSD-src-c464bca234e43e5c9d7076042f3261ce368fbc4e.zip FreeBSD-src-c464bca234e43e5c9d7076042f3261ce368fbc4e.tar.gz |
Add the -n option, which automatically answers "no" to the overwrite question.
PR: 7828
Suggested by: Daniel O'Connor <doconnor@gsoft.com.au>
Approved by: sheldonh (mentor)
MFC after: 2 weeks
Diffstat (limited to 'bin/cp/utils.c')
-rw-r--r-- | bin/cp/utils.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c index a10daa9..364f983 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -87,7 +87,11 @@ copy_file(FTSENT *entp, int dne) */ if (!dne) { #define YESNO "(y/n [n]) " - if (iflag) { + if (nflag) { + if (vflag) + printf("%s not overwritten\n", to.p_path); + return (0); + } else if (iflag) { (void)fprintf(stderr, "overwrite %s? %s", to.p_path, YESNO); checkch = ch = getchar(); @@ -300,7 +304,7 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n", -"usage: cp [-R [-H | -L | -P]] [-f | -i] [-pv] src target", -" cp [-R [-H | -L | -P]] [-f | -i] [-pv] src1 ... srcN directory"); +"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target", +" cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory"); exit(EX_USAGE); } |