• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/netatalk-2.2.5/bin/ad/

Lines Matching refs:to

6  * This code is derived from software contributed to Berkeley by
18 * may be used to endorse or promote products derived from this software
35 * Cp copies source files to target files.
37 * The global PATH_T structure "to" always contains the path to the
41 * The basic algorithm is to initialize "to" and use fts(3) to traverse
45 * path (relative to the root of the traversal) is appended to dir (stored
46 * in "to") to form the final target path.
84 PATH_T to = { to.p_path, emptystring, "" };
116 Returns pointer to name or NULL.
178 "In the first synopsis form, the cp utility copies the contents of the source_file to the\n"
179 "target_file. In the second synopsis form, the contents of each named source_file is copied to the\n"
181 "attempt to copy a file to itself, the copy will fail.\n\n"
193 " -i Cause cp to write a prompt to the standard error output before\n"
200 " -p Cause cp to preserve the following attributes of each source file\n"
209 " -v Cause cp to be verbose, showing files as they are copied.\n\n"
271 /* Save the target base in "to". */
273 if ((strlcpy(to.p_path, target, PATH_MAX)) >= PATH_MAX)
276 to.p_end = to.p_path + strlen(to.p_path);
277 if (to.p_path == to.p_end) {
278 *to.p_end++ = '.';
279 *to.p_end = 0;
281 have_trailing_slash = (to.p_end[-1] == '/');
283 STRIP_TRAILING_SLASH(to);
284 to.target_end = to.p_end;
303 r = stat(to.p_path, &to_stat);
305 ERROR("%s", to.p_path);
311 ERROR("%s is not a directory", to.p_path);
314 * Need to detect the case:
332 ERROR("directory %s does not exist", to.p_path);
334 ERROR("%s is not a directory", to.p_path);
355 openvol(to.p_path, &dvolume);
403 * If we are in case (2) above, we need to append the
404 * source name to the target name.
408 * Need to remember the roots of traversals to create
410 * copied to a non-existent directory, e.g.
419 * Paths ending in ".." are changed to ".". This is
420 * tricky, but seems the easiest way to fix the problem.
438 target_mid = to.target_end;
442 if (target_mid - to.p_path + nlen >= PATH_MAX) {
443 SLOG("%s%s: name too long (not copied)", to.p_path, p);
448 to.p_end = target_mid + nlen;
449 *to.p_end = 0;
450 STRIP_TRAILING_SLASH(to);
453 /* Not an error but need to remember it happened */
454 if (stat(to.p_path, &to_stat) == -1)
459 SLOG("%s and %s are identical (not copied).", to.p_path, path);
470 to.p_path, path);
477 /* Convert basename to appropiate volume encoding */
479 if ((convert_dots_encoding(&svolume, &dvolume, to.p_path, MAXPATHLEN)) == -1) {
480 SLOG("Error converting name for %s", to.p_path);
501 * able to write the directory (if from directory is
506 if (mkdir(to.p_path, statp->st_mode | S_IRWXU) < 0)
507 ERROR("mkdir: %s: %s", to.p_path, strerror(errno));
510 ERROR("%s", to.p_path);
518 bstring addir = bfromcstr(to.p_path);
525 if (dvolume.volume.vfs->vfs_copyfile(&dvolume.volume, -1, path, to.p_path)) {
526 SLOG("Error copying adouble for %s -> %s", path, to.p_path);
532 /* Get CNID of Parent and add new childir to CNID database */
534 if ((did = cnid_for_path(&dvolume, to.p_path, &pdid)) == CNID_INVALID) {
535 SLOG("Error resolving CNID for %s", to.p_path);
542 if (lstat(to.p_path, &st) != 0) {
547 if (ad_open_metadata(to.p_path, ADFLAGS_DIR, O_RDWR | O_CREAT, &ad) != 0) {
548 ERROR("Error opening adouble for: %s", to.p_path);
551 ad_setname(&ad, utompath(&dvolume.volinfo, basename(to.p_path)));
566 if (preserve_dir_acls(statp, curr->fts_accpath, to.p_path) != 0)
591 if (dvolume.volume.vfs->vfs_copyfile(&dvolume.volume, -1, path, to.p_path)) {
592 SLOG("Error copying adouble for %s -> %s", path, to.p_path);
598 /* Get CNID of Parent and add new childir to CNID database */
601 if ((cnid = cnid_for_path(&dvolume, to.p_path, &did)) == CNID_INVALID) {
602 SLOG("Error resolving CNID for %s", to.p_path);
609 if (lstat(to.p_path, &st) != 0) {
614 if (ad_open_metadata(to.p_path, 0, O_RDWR | O_CREAT, &ad) != 0) {
615 ERROR("Error opening adouble for: %s", to.p_path);
618 ad_setname(&ad, utompath(&dvolume.volinfo, basename(to.p_path)));
630 (void)printf("%s -> %s\n", path, to.p_path);
638 /* Maximum buffer size in bytes - do not allow it to grow larger than this */
641 /* Small (default) buffer size in bytes. It's inefficient for this to be smaller than MAXPHYS */
666 * If the file DNE, set the mode to be the from file, minus setuid
676 printf("%s not overwritten\n", to.p_path);
681 to.p_path, YESNO);
695 (void)unlink(to.p_path);
696 (void)dvolume.volume.vfs->vfs_deletefile(&dvolume.volume, -1, to.p_path);
697 to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
701 to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
704 to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
709 SLOG("%s: %s", to.p_path, strerror(errno));
739 SLOG("%s: %s", to.p_path, strerror(errno));
776 SLOG("%s: %s", to.p_path, strerror(errno));
791 * to remove it if we created it and its length is 0.
799 SLOG("%s: %s", to.p_path, strerror(errno));
821 if (exists && unlink(to.p_path)) {
822 SLOG("unlink: %s: %s", to.p_path, strerror(errno));
825 if (symlink(llink, to.p_path)) {
852 if (utimes(to.p_path, tv)) {
853 SLOG("utimes: %s", to.p_path);
857 (islink ? lstat(to.p_path, &ts) : stat(to.p_path, &ts)))
867 * the mode; current BSD behavior is to remove all setuid bits on
872 (islink ? lchown(to.p_path, fs->st_uid, fs->st_gid) :
873 chown(to.p_path, fs->st_uid, fs->st_gid))) {
875 SLOG("chown: %s: %s", to.p_path, strerror(errno));
882 if (fdval ? fchmod(fd, mode) : chmod(to.p_path, mode)) {
883 SLOG("chmod: %s: %s", to.p_path, strerror(errno));
891 (islink ? lchflags(to.p_path, fs->st_flags) :
892 chflags(to.p_path, fs->st_flags))) {
893 SLOG("chflags: %s: %s", to.p_path, strerror(errno));
913 warn("fpathconf(..., _PC_ACL_NFS4) failed for %s", to.p_path);
923 to.p_path);
932 warn("failed to get acl entries while setting %s", to.p_path);
936 warn("acl_is_trivial() failed for %s", to.p_path);
945 warn("failed to set acl entries for %s", to.p_path);
999 * size ACL will be returned. So it is not safe to simply
1000 * check the pointer to see if the default ACL is present.
1004 warn("failed to get default acl entries on %s",
1011 warn("failed to set default acl entries on %s",
1020 warn("failed to get acl entries on %s", source_dir);
1033 warn("failed to set acl entries on %s", dest_dir);