Lines Matching +full:trade +full:- +full:off

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
40 * this path can be either absolute or dot-relative.
67 while ((p).p_end > (p).p_path + 1 && (p).p_end[-1] == '/') \
68 *--(p).p_end = 0; \
93 while ((ch = getopt(argc, argv, "HLPRafilNnprsvx")) != -1)
153 argc -= optind;
160 errx(1, "the -R and -r options may not be specified together");
162 errx(1, "the -l and -s options may not be specified together");
179 target = argv[--argc];
187 have_trailing_slash = (to.p_end[-1] == '/');
198 * cp [-R] source target
199 * cp [-R] source1 ... sourceN directory
210 if (r == -1 && errno != ENOENT)
212 if (r == -1 || !S_ISDIR(to_stat.st_mode)) {
221 * cp -R dir foo
226 if (r == -1) {
240 if (r == -1) {
277 * permissions on created directories when not using -p.
286 switch (curr->fts_info) {
290 warnc(curr->fts_errno, "%s", curr->fts_path);
294 warnx("%s: directory causes a cycle", curr->fts_path);
302 * Stash the root basename off for detecting recursion later.
305 * rolling with -L or -H. The later bits will need this bit in
308 if (curr->fts_level == FTS_ROOTLEVEL) {
309 strlcpy(rootname, curr->fts_name, sizeof(rootname));
320 * copied to a non-existent directory, e.g.
321 * cp -R a/dir noexist
328 * cp -R .. /tmp
336 if (curr->fts_level == FTS_ROOTLEVEL) {
338 p = strrchr(curr->fts_path, '/');
340 (int)(p - curr->fts_path + 1);
342 if (!strcmp(&curr->fts_path[base],
346 base = curr->fts_pathlen;
349 p = &curr->fts_path[base];
350 nlen = curr->fts_pathlen - base;
352 if (*p != '/' && target_mid[-1] != '/')
355 if (target_mid - to.p_path + nlen >= PATH_MAX) {
373 if (curr->fts_info == FTS_D && root_stat != NULL &&
374 root_stat->st_dev == curr->fts_statp->st_dev &&
375 root_stat->st_ino == curr->fts_statp->st_ino) {
390 rootname) == -1)
401 if (curr->fts_info == FTS_DP) {
407 if (!curr->fts_number)
410 * If -p is in effect, set all the attributes.
419 if (setfile(curr->fts_statp, -1))
421 if (preserve_dir_acls(curr->fts_statp,
422 curr->fts_accpath, to.p_path) != 0)
425 mode = curr->fts_statp->st_mode;
439 to_stat.st_dev == curr->fts_statp->st_dev &&
440 to_stat.st_ino == curr->fts_statp->st_ino) {
442 to.p_path, curr->fts_path);
444 if (S_ISDIR(curr->fts_statp->st_mode))
452 switch (curr->fts_statp->st_mode & S_IFMT) {
456 curr->fts_level == 0)) {
474 curr->fts_path);
482 * modified by the umask. Trade-off between being
488 mode = curr->fts_statp->st_mode | S_IRWXU;
519 * (in the post-order phase) if this is a new
520 * directory, or if the -p flag is in effect.
522 curr->fts_number = pflag || dne;
527 if (copy_special(curr->fts_statp, !dne))
536 curr->fts_path);
540 if (copy_fifo(curr->fts_statp, !dne))
553 (void)printf("%s -> %s\n", curr->fts_path, to.p_path);