summaryrefslogtreecommitdiffstats
path: root/bin/cp/cp.c
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-06-08 19:24:18 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-06-08 19:24:18 +0000
commit70ea701e5372ca5379962b572d577db3624ff317 (patch)
treeb2f0d4fa3833ad301604f94425e31c4824a1f525 /bin/cp/cp.c
parent02d6f9793e77d31210bea137c2f400f4acb5ee8c (diff)
downloadFreeBSD-src-70ea701e5372ca5379962b572d577db3624ff317.zip
FreeBSD-src-70ea701e5372ca5379962b572d577db3624ff317.tar.gz
Cleanup some style(9) issues.
- Whitespace. - Comments. - Wrap long lines. MFC after: 2 weeks X-MFC-with: r284105,r284106 Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'bin/cp/cp.c')
-rw-r--r--bin/cp/cp.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c
index 18eb52e..11e3633 100644
--- a/bin/cp/cp.c
+++ b/bin/cp/cp.c
@@ -75,8 +75,8 @@ __FBSDID("$FreeBSD$");
#include "extern.h"
#define STRIP_TRAILING_SLASH(p) { \
- while ((p).p_end > (p).p_path + 1 && (p).p_end[-1] == '/') \
- *--(p).p_end = 0; \
+ while ((p).p_end > (p).p_path + 1 && (p).p_end[-1] == '/') \
+ *--(p).p_end = 0; \
}
static char emptystring[] = "";
@@ -188,7 +188,7 @@ main(int argc, char *argv[])
if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path))
errx(1, "%s: name too long", target);
to.p_end = to.p_path + strlen(to.p_path);
- if (to.p_path == to.p_end) {
+ if (to.p_path == to.p_end) {
*to.p_end++ = '.';
*to.p_end = 0;
}
@@ -245,10 +245,10 @@ main(int argc, char *argv[])
type = FILE_TO_FILE;
if (have_trailing_slash && type == FILE_TO_FILE) {
- if (r == -1)
+ if (r == -1) {
errx(1, "directory %s does not exist",
- to.p_path);
- else
+ to.p_path);
+ } else
errx(1, "%s is not a directory", to.p_path);
}
} else
@@ -299,8 +299,8 @@ copy(char *argv[], enum op type, int fts_options)
/*
* If we are in case (2) or (3) above, we need to append the
- * source name to the target name.
- */
+ * source name to the target name.
+ */
if (type != FILE_TO_FILE) {
/*
* Need to remember the roots of traversals to create
@@ -379,7 +379,8 @@ copy(char *argv[], enum op type, int fts_options)
mode = curr->fts_statp->st_mode;
if ((mode & (S_ISUID | S_ISGID | S_ISTXT)) ||
((mode | S_IRWXU) & mask) != (mode & mask))
- if (chmod(to.p_path, mode & mask) != 0){
+ if (chmod(to.p_path, mode & mask) !=
+ 0) {
warn("chmod: %s", to.p_path);
rval = 1;
}
@@ -387,7 +388,7 @@ copy(char *argv[], enum op type, int fts_options)
continue;
}
- /* Not an error but need to remember it happened */
+ /* Not an error but need to remember it happened. */
if (stat(to.p_path, &to_stat) == -1)
dne = 1;
else {
@@ -413,7 +414,7 @@ copy(char *argv[], enum op type, int fts_options)
switch (curr->fts_statp->st_mode & S_IFMT) {
case S_IFLNK:
- /* Catch special case of a non-dangling symlink */
+ /* Catch special case of a non-dangling symlink. */
if ((fts_options & FTS_LOGICAL) ||
((fts_options & FTS_COMFOLLOW) &&
curr->fts_level == 0)) {
@@ -438,7 +439,7 @@ copy(char *argv[], enum op type, int fts_options)
* modified by the umask. Trade-off between being
* able to write the directory (if from directory is
* 555) and not causing a permissions race. If the
- * umask blocks owner writes, we fail..
+ * umask blocks owner writes, we fail.
*/
if (dne) {
if (mkdir(to.p_path,
@@ -467,7 +468,7 @@ copy(char *argv[], enum op type, int fts_options)
break;
case S_IFSOCK:
warnx("%s is a socket (not copied).",
- curr->fts_path);
+ curr->fts_path);
break;
case S_IFIFO:
if (Rflag && !sflag) {
OpenPOWER on IntegriCloud