summaryrefslogtreecommitdiffstats
path: root/bin/cp
diff options
context:
space:
mode:
authormharo <mharo@FreeBSD.org>1999-08-29 07:58:19 +0000
committermharo <mharo@FreeBSD.org>1999-08-29 07:58:19 +0000
commit5e14615656821e43d8611a79c78c045e4d636190 (patch)
tree8b96b3dcce9330ec35a8a12894863500d1957d31 /bin/cp
parentbd14e46d740faa5132d836cc532864ff7f41f228 (diff)
downloadFreeBSD-src-5e14615656821e43d8611a79c78c045e4d636190.zip
FreeBSD-src-5e14615656821e43d8611a79c78c045e4d636190.tar.gz
brucify and move printf() to catch cases of special files
Diffstat (limited to 'bin/cp')
-rw-r--r--bin/cp/cp.16
-rw-r--r--bin/cp/cp.c4
-rw-r--r--bin/cp/utils.c8
3 files changed, 7 insertions, 11 deletions
diff --git a/bin/cp/cp.1 b/bin/cp/cp.1
index 29a997f..f51a28e 100644
--- a/bin/cp/cp.1
+++ b/bin/cp/cp.1
@@ -48,8 +48,7 @@
.Op Fl H | Fl L | Fl P
.Oc
.Op Fl f | i
-.Op Fl p
-.Op Fl v
+.Op Fl pv
.Ar source_file target_file
.Nm cp
.Oo
@@ -57,8 +56,7 @@
.Op Fl H | Fl L | Fl P
.Oc
.Op Fl f | i
-.Op Fl p
-.Op Fl v
+.Op Fl pv
.Ar source_file ... target_directory
.Sh DESCRIPTION
In the first synopsis form, the
diff --git a/bin/cp/cp.c b/bin/cp/cp.c
index 488e7d8..9b5c05f 100644
--- a/bin/cp/cp.c
+++ b/bin/cp/cp.c
@@ -378,8 +378,6 @@ copy(argv, type, fts_options)
if (mkdir(to.p_path,
curr->fts_statp->st_mode | S_IRWXU) < 0)
err(1, "%s", to.p_path);
- if (vflag)
- printf("%s -> %s\n", curr->fts_path, to.p_path);
} else if (!S_ISDIR(to_stat.st_mode)) {
errno = ENOTDIR;
err(1, "%s", to.p_path);
@@ -420,6 +418,8 @@ copy(argv, type, fts_options)
rval = 1;
break;
}
+ if (!rval && vflag)
+ (void)printf("%s -> %s\n", curr->fts_path, to.p_path);
}
if (errno)
err(1, "fts_read");
diff --git a/bin/cp/utils.c b/bin/cp/utils.c
index 2c02947..368886a 100644
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -118,9 +118,6 @@ copy_file(entp, dne)
rval = 0;
- if (vflag)
- printf("%s -> %s\n",entp->fts_path, to.p_path);
-
/*
* Mmap and write if less than 8M (the limit is so we don't totally
* trash memory on big files. This is really a minor hack, but it
@@ -323,8 +320,9 @@ setfile(fs, fd)
void
usage()
{
+
(void)fprintf(stderr, "%s\n%s\n",
-"usage: cp [-R [-H | -L | -P]] [-f | -i] [-p] [-v] src target",
-" cp [-R [-H | -L | -P]] [-f | -i] [-p] [-v] src1 ... srcN directory");
+"usage: cp [-R [-H | -L | -P]] [-f | -i] [-pv] src target",
+" cp [-R [-H | -L | -P]] [-f | -i] [-pv] src1 ... srcN directory");
exit(1);
}
OpenPOWER on IntegriCloud