Lines Matching refs:target
226 char target[PATH_MAX]; in main() local
455 (void) strcpy(target, "."); in main()
457 (void) strcpy(target, argv[--argc]); in main()
473 r += move(argv[i], target); in main()
483 lnkfil(const char *source, char *target) in lnkfil() argument
495 if ((stat(target, &s2) >= 0) && ISDIR(s2)) { in lnkfil()
498 len = strlen(target) + strlen(dname(source)) + 4; in lnkfil()
506 target, dname(source)); in lnkfil()
507 target = buf; in lnkfil()
517 if ((lstat(target, &s2) == 0)) { in lnkfil()
533 target); in lnkfil()
544 "(%s/%s)? "), cmd, target, yesstr, in lnkfil()
551 if (unlink(target) < 0) { in lnkfil()
554 cmd, target); in lnkfil()
573 if (symlink(source, target) < 0) { in lnkfil()
576 cmd, target); in lnkfil()
587 switch (chkfiles(source, &target)) { in lnkfil()
611 if (link(source, target) < 0) { in lnkfil()
615 cmd, target); in lnkfil()
619 cmd, target); in lnkfil()
633 cpymve(const char *source, char *target) in cpymve() argument
643 switch (chkfiles(source, &target)) { in cpymve()
689 rc = copydir(source, target); in cpymve()
712 return (copyspecial(target)); in cpymve()
719 if (rename(source, target) >= 0) in cpymve()
730 cmd, source, target); in cpymve()
744 " %s \n"), cmd, source, target); in cpymve()
751 if (rmdir(target) < 0) { in cpymve()
755 cmd, target); in cpymve()
762 if ((n = copydir(source, target)) == 0) in cpymve()
793 if (targetexists && unlink(target) < 0) { in cpymve()
796 cmd, target); in cpymve()
809 if (symlink(symln, target) < 0) { in cpymve()
810 Perror(target); in cpymve()
814 m = lchown(target, UID(s1), GID(s1)); in cpymve()
819 " %s: "), cmd, target); in cpymve()
827 if (targetexists && unlink(target) < 0) { in cpymve()
830 cmd, target); in cpymve()
835 if (mknod(target, s1.st_mode, s1.st_rdev) < 0) { in cpymve()
836 Perror(target); in cpymve()
840 (void) chg_mode(target, UID(s1), GID(s1), FMODE(s1)); in cpymve()
841 (void) chg_time(target, s1); in cpymve()
847 if (targetexists && rmdir(target) < 0) { in cpymve()
850 cmd, target); in cpymve()
855 if (targetexists && unlink(target) < 0) { in cpymve()
858 cmd, target); in cpymve()
895 if (symlink(symln, target) < 0) { in cpymve()
896 Perror(target); in cpymve()
900 m = lchown(target, UID(s1), GID(s1)); in cpymve()
905 "group of %s:"), target); in cpymve()
923 fo = creat(target, s1.st_mode & MODEBITS); in cpymve()
930 (void) unlink(target); in cpymve()
931 fo = creat(target, in cpymve()
938 cmd, target); in cpymve()
944 (void) stat(target, &s2); in cpymve()
958 (void) chmod(target, FMODE(s1)); in cpymve()
960 if ((acl_set(target, in cpymve()
968 target); in cpymve()
989 cmd, source, target); in cpymve()
993 if (writefile(fi, fo, source, target, NULL, in cpymve()
1000 Perror2(target, "write"); in cpymve()
1006 attret = copyattributes(source, target); in cpymve()
1015 sattret = copy_sysattr(source, target); in cpymve()
1017 (void) unlink(target); in cpymve()
1030 if ((ret = chg_mode(target, UID(s1), GID(s1), in cpymve()
1038 if ((acl_set(target, s1acl)) < 0) { in cpymve()
1043 "on %s\n"), cmd, target); in cpymve()
1050 if ((ret = chg_time(target, s1)) > 0) in cpymve()
1067 (void) unlink(target); in cpymve()
1115 char *target = *to; in chkfiles() local
1160 if ((*statf)(target, &s2) >= 0) { in chkfiles()
1162 (void) stat(target, &s2); in chkfiles()
1171 len = strlen(target) + strlen(dname(source)) + 4; in chkfiles()
1179 target, dname(source)); in chkfiles()
1180 *to = target = buf; in chkfiles()
1183 if ((*statf)(target, &s2) >= 0) { in chkfiles()
1203 cmd, source, target); in chkfiles()
1216 if (!chk_different(source, target)) { in chkfiles()
1287 if (mve && access(target, W_OK) < 0 && in chkfiles()
1297 cmd, target); in chkfiles()
1308 if (mve && access(target, W_OK) < 0 && in chkfiles()
1327 target, FMODE(s2) & MODEBITS, in chkfiles()
1332 target, yesstr, nostr); in chkfiles()
1336 "(%s/%s)? "), cmd, target, in chkfiles()
1347 if (lnk && unlink(target) < 0) { in chkfiles()
1350 cmd, target); in chkfiles()
1365 chk_different(const char *source, const char *target) in chk_different() argument
1375 (getrealpath(target, rtarget) == 0)) { in chk_different()
1381 cmd, source, target); in chk_different()
1571 chg_mode(const char *target, uid_t uid, gid_t gid, mode_t mode) in chg_mode() argument
1577 if (lstat(target, &st) == 0 && ISLNK(st)) in chg_mode()
1580 if (chown(target, uid, gid) != 0) { in chg_mode()
1584 " owner and group of %s: "), cmd, target); in chg_mode()
1594 if (chmod(target, mode) != 0) { in chg_mode()
1598 " %s: "), cmd, target); in chg_mode()
1607 "%s: cannot set permissions for %s: "), cmd, target); in chg_mode()
1642 copydir(const char *source, char *target) argument
1660 if (stat(target, &s2) < 0) {
1661 if (mkdir(target, (s1.st_mode & MODEBITS)) < 0) {
1663 perror(target);
1666 if (stat(target, &s2) == 0) {
1671 (void) chmod(target, ((fixmode & MODEBITS) | S_IRWXU));
1674 gettext("%s: %s: not a directory.\n"), cmd, target);
1707 ret = rcopy(source, target);
1718 if ((pret = chg_mode(target, UID(s1save), GID(s1save),
1720 pret = chg_time(target, s1save);
1723 if (acl_set(target, s1acl_save) < 0) {
1732 "on %s\n"), cmd, target);
1745 (void) chmod(target, fixmode & MODEBITS);
1748 attret = copyattributes(source, target);
1761 sattret = copy_sysattr(source, target);
1776 copyspecial(const char *target) argument
1780 if (mknod(target, s1.st_mode, s1.st_rdev) != 0) {
1782 "cp: cannot create special file %s: "), target);
1788 if ((ret = chg_mode(target, UID(s1), GID(s1), FMODE(s1))) == 0)
1789 ret = chg_time(target, s1);
1808 copyattributes(const char *source, const char *target) argument
1823 if (pathconf(target, _PC_XATTR_ENABLED) != 1) {
1829 " %s\n"), cmd, target);
1835 if (open_target_srctarg_attrdirs(source, target) != 0)
1846 " file %s: "), cmd, target);
1857 " directory of file %s: "), cmd, target);
1872 " for %s: "), cmd, target);
1900 "for %s\n"), cmd, target);
1912 if ((ret = traverse_attrfile(dp, source, target, 1)) == -1)
1942 "%s\n"), cmd, dp->d_name, target);
1950 if (writefile(srcattrfd, targattrfd, source, target,
1967 " %s: "), cmd, dp->d_name, target);
1983 " times for %s: "), cmd, target);
1994 " %s: "), cmd, dp->d_name, target);
2000 " %s for %s: "), cmd, dp->d_name, target);
2011 "%s\n"), cmd, dp->d_name, target);
2047 copy_sysattr(const char *source, const char *target) argument
2068 if (sysattr_support(target, _PC_SATTR_ENABLED) != 1) {
2074 " %s\n"), cmd, target);
2085 target) != 0) {
2100 if ((ret = traverse_attrfile(dp, source, target,
2128 dp->d_name, source, target);
2146 "%s to %s\n"), cmd, source, target);
2303 traverse_attrfile(struct dirent *dp, const char *source, const char *target, argument
2349 target);
2362 target);
2376 " %s: "), cmd, dp->d_name, target);