brucify and move printf() to catch cases of special files
This commit is contained in:
parent
f480eea50b
commit
779ca8c356
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user