brucify and move printf() to catch cases of special files

This commit is contained in:
mharo 1999-08-29 07:58:19 +00:00
parent f480eea50b
commit 779ca8c356
3 changed files with 7 additions and 11 deletions

View File

@ -48,8 +48,7 @@
.Op Fl H | Fl L | Fl P .Op Fl H | Fl L | Fl P
.Oc .Oc
.Op Fl f | i .Op Fl f | i
.Op Fl p .Op Fl pv
.Op Fl v
.Ar source_file target_file .Ar source_file target_file
.Nm cp .Nm cp
.Oo .Oo
@ -57,8 +56,7 @@
.Op Fl H | Fl L | Fl P .Op Fl H | Fl L | Fl P
.Oc .Oc
.Op Fl f | i .Op Fl f | i
.Op Fl p .Op Fl pv
.Op Fl v
.Ar source_file ... target_directory .Ar source_file ... target_directory
.Sh DESCRIPTION .Sh DESCRIPTION
In the first synopsis form, the In the first synopsis form, the

View File

@ -378,8 +378,6 @@ copy(argv, type, fts_options)
if (mkdir(to.p_path, if (mkdir(to.p_path,
curr->fts_statp->st_mode | S_IRWXU) < 0) curr->fts_statp->st_mode | S_IRWXU) < 0)
err(1, "%s", to.p_path); 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)) { } else if (!S_ISDIR(to_stat.st_mode)) {
errno = ENOTDIR; errno = ENOTDIR;
err(1, "%s", to.p_path); err(1, "%s", to.p_path);
@ -420,6 +418,8 @@ copy(argv, type, fts_options)
rval = 1; rval = 1;
break; break;
} }
if (!rval && vflag)
(void)printf("%s -> %s\n", curr->fts_path, to.p_path);
} }
if (errno) if (errno)
err(1, "fts_read"); err(1, "fts_read");

View File

@ -118,9 +118,6 @@ copy_file(entp, dne)
rval = 0; 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 * 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 * trash memory on big files. This is really a minor hack, but it
@ -323,8 +320,9 @@ setfile(fs, fd)
void void
usage() usage()
{ {
(void)fprintf(stderr, "%s\n%s\n", (void)fprintf(stderr, "%s\n%s\n",
"usage: cp [-R [-H | -L | -P]] [-f | -i] [-p] [-v] src target", "usage: cp [-R [-H | -L | -P]] [-f | -i] [-pv] src target",
" cp [-R [-H | -L | -P]] [-f | -i] [-p] [-v] src1 ... srcN directory"); " cp [-R [-H | -L | -P]] [-f | -i] [-pv] src1 ... srcN directory");
exit(1); exit(1);
} }