Lines Matching refs:to

7  * This code is derived from software contributed to Berkeley by
19 * may be used to endorse or promote products derived from this software
51 * Cp copies source files to target files.
53 * The global PATH_T structure "to" always contains the path to the
57 * The basic algorithm is to initialize "to" and use fts(3) to traverse
61 * path (relative to the root of the traversal) is appended to dir (stored
62 * in "to") to form the final target path.
87 PATH_T to = { .p_end = to.p_path, .target_end = empty };
210 /* Save the target base in "to". */
212 if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path))
214 to.p_end = to.p_path + strlen(to.p_path);
215 have_trailing_slash = (to.p_end[-1] == '/');
217 STRIP_TRAILING_SLASH(to);
218 to.target_end = to.p_end;
242 r = lstat(to.p_path, &to_stat);
244 r = stat(to.p_path, &to_stat);
246 err(EXIT_FAILURE, "%s", to.p_path);
256 * Need to detect the case:
282 to.p_path);
284 errx(1, "%s is not a directory", to.p_path);
360 * If we are in case (2) or (3) above, we need to append the
361 * source name to the target name.
365 to.target_end - to.p_path + 1) > MAXPATHLEN) {
367 to.p_path, curr->fts_name);
373 * Need to remember the roots of traversals to create
375 * copied to a non-existent directory, e.g.
384 * Paths ending in ".." are changed to ".". This is
385 * tricky, but seems the easiest way to fix the problem.
406 target_mid = to.target_end;
411 if (target_mid - to.p_path + nlen >= PATH_MAX) {
413 to.p_path, p);
418 to.p_end = target_mid + nlen;
419 *to.p_end = 0;
420 STRIP_TRAILING_SLASH(to);
423 sval = Pflag ? lstat(to.p_path, &to_stat) : stat(to.p_path, &to_stat);
424 /* Not an error but need to remember it happened */
431 to.p_path, curr->fts_path);
440 to.p_path, curr->fts_path);
480 * able to write the directory (if from directory is
486 if (mkdir(to.p_path,
489 to.p_path);
494 to.p_path);
501 * If not -p and directory didn't exist, set it to be
509 (void)chmod(to.p_path,
544 (void)printf("%s -> %s\n", curr->fts_path, to.p_path);