Lines Matching defs:target

143 	char target[PATH_MAX];
185 * cp [ -r|-R [-H|-L|-P]] [-afip@/] file1 [file2 ...] target
186 * cp [-afiprR@/] file1 [file2 ...] target
187 * ln [-f] [-n] [-s] file1 [file2 ...] target
189 * mv [-f|i] file1 [file2 ...] target
190 * mv [-f|i] dir1 target
332 * If there is more than a source and target,
333 * the last argument (the target) must be a directory
363 (void) strcpy(target, ".");
365 (void) strcpy(target, argv[--argc]);
381 r += move(argv[i], target);
392 lnkfil(char *source, char *target)
399 * If target is a directory make complete
404 if ((stat(target, &s2) >= 0) && ISDIR(s2)) {
407 len = strlen(target) + strlen(dname(source)) + 4;
415 target, dname(source));
416 target = buf;
426 if ((lstat(target, &s2) == 0)) {
430 * target to replace with the new target, specified
443 target);
446 if (unlink(target) < 0) {
449 cmd, target);
461 if (symlink(source, target) < 0) {
464 cmd, target);
475 switch (chkfiles(source, &target)) {
496 if (link(source, target) < 0) {
500 cmd, target);
504 cmd, target);
518 cpymve(char *source, char *target)
528 switch (chkfiles(source, &target)) {
571 rc = copydir(source, target);
594 return (copyspecial(target));
601 if (rename(source, target) >= 0)
612 cmd, source, target);
619 * directory (target)
626 " %s \n"), cmd, source, target);
632 /* existing target dir must be empty */
633 if (rmdir(target) < 0) {
637 cmd, target);
644 if ((n = copydir(source, target)) == 0)
675 if (targetexists && unlink(target) < 0) {
678 cmd, target);
691 if (symlink(symln, target) < 0) {
692 Perror(target);
696 m = lchown(target, UID(s1), GID(s1));
701 " %s: "), cmd, target);
709 if (targetexists && unlink(target) < 0) {
712 cmd, target);
717 if (mknod(target, s1.st_mode, s1.st_rdev) < 0) {
718 Perror(target);
722 (void) chg_mode(target, UID(s1), GID(s1), FMODE(s1));
723 (void) chg_time(target, s1);
729 if (targetexists && rmdir(target) < 0) {
732 cmd, target);
737 if (targetexists && unlink(target) < 0) {
740 cmd, target);
770 * Copy the sym link to the target.
771 * Note: If the target exists, write a
777 if (symlink(symln, target) < 0) {
778 Perror(target);
782 m = lchown(target, UID(s1), GID(s1));
787 "group of %s:"), target);
805 fo = creat(target, s1.st_mode & MODEBITS);
812 (void) unlink(target);
813 fo = creat(target,
820 cmd, target);
826 (void) stat(target, &s2);
830 * Set target's permissions to the source
840 (void) chmod(target, FMODE(s1));
842 if ((acl_set(target,
850 target);
871 cmd, source, target);
875 if (writefile(fi, fo, source, target, NULL,
882 Perror2(target, "write");
888 attret = copyattributes(source, target);
897 sattret = copy_sysattr(source, target);
899 (void) unlink(target);
912 if ((ret = chg_mode(target, UID(s1), GID(s1),
920 if ((acl_set(target, s1acl)) < 0) {
925 "on %s\n"), cmd, target);
932 if ((ret = chg_time(target, s1)) > 0)
949 (void) unlink(target);
997 char *target = *to;
1036 * If stat fails, then the target doesn't exist,
1037 * we will create a new target with default file type of regular.
1042 if ((*statf)(target, &s2) >= 0) {
1044 (void) stat(target, &s2);
1046 * If target is a directory,
1053 len = strlen(target) + strlen(dname(source)) + 4;
1061 target, dname(source));
1062 *to = target = buf;
1065 if ((*statf)(target, &s2) >= 0) {
1073 * source and target are the same file.
1077 * error when the source and target are
1084 cmd, source, target);
1093 * target are identical files (same inode,
1097 if (!chk_different(source, target)) {
1106 cmd, target);
1115 * the target, ask ----if it is not
1139 override = !cpy && (access(target, 2) < 0) &&
1145 "protection %o (%s/%s)? "), cmd, target,
1155 cmd, target, yesstr, nostr);
1167 cmd, target, FMODE(s2) & MODEBITS,
1176 if (lnk && unlink(target) < 0) {
1179 cmd, target);
1189 * check whether source and target are different
1194 chk_different(char *source, char *target)
1204 (getrealpath(target, rtarget) == 0)) {
1210 cmd, source, target);
1385 * try to clear S_ISUID and S_ISGID bits in the target. If unable to clear
1395 chg_mode(char *target, uid_t uid, gid_t gid, mode_t mode)
1400 /* Don't change mode if target is symlink */
1401 if (lstat(target, &st) == 0 && ISLNK(st))
1404 if (chown(target, uid, gid) != 0) {
1408 " owner and group of %s: "), cmd, target);
1418 if (chmod(target, mode) != 0) {
1422 " %s: "), cmd, target);
1431 "%s: cannot set permissions for %s: "), cmd, target);
1466 copydir(char *source, char *target)
1484 if (stat(target, &s2) < 0) {
1485 if (mkdir(target, (s1.st_mode & MODEBITS)) < 0) {
1487 perror(target);
1490 if (stat(target, &s2) == 0) {
1495 (void) chmod(target, ((fixmode & MODEBITS) | S_IRWXU));
1498 gettext("%s: %s: not a directory.\n"), cmd, target);
1531 ret = rcopy(source, target);
1542 if ((pret = chg_mode(target, UID(s1save), GID(s1save),
1544 pret = chg_time(target, s1save);
1547 if (acl_set(target, s1acl_save) < 0) {
1556 "on %s\n"), cmd, target);
1569 (void) chmod(target, fixmode & MODEBITS);
1572 attret = copyattributes(source, target);
1585 sattret = copy_sysattr(source, target);
1600 copyspecial(char *target)
1604 if (mknod(target, s1.st_mode, s1.st_rdev) != 0) {
1606 "cp: cannot create special file %s: "), target);
1612 if ((ret = chg_mode(target, UID(s1), GID(s1), FMODE(s1))) == 0)
1613 ret = chg_time(target, s1);
1632 copyattributes(char *source, char *target)
1647 if (pathconf(target, _PC_XATTR_ENABLED) != 1) {
1653 " %s\n"), cmd, target);
1659 if (open_target_srctarg_attrdirs(source, target) != 0)
1670 " file %s: "), cmd, target);
1681 " directory of file %s: "), cmd, target);
1696 " for %s: "), cmd, target);
1724 "for %s\n"), cmd, target);
1736 if ((ret = traverse_attrfile(dp, source, target, 1)) == -1)
1766 "%s\n"), cmd, dp->d_name, target);
1774 if (writefile(srcattrfd, targattrfd, source, target,
1791 " %s: "), cmd, dp->d_name, target);
1807 " times for %s: "), cmd, target);
1818 " %s: "), cmd, dp->d_name, target);
1824 " %s for %s: "), cmd, dp->d_name, target);
1835 "%s\n"), cmd, dp->d_name, target);
1868 /* Copy extended system attributes from source to target */
1871 copy_sysattr(char *source, char *target)
1886 * source file to copy to the target. The target has
1892 if (sysattr_support(target, _PC_SATTR_ENABLED) != 1) {
1898 " %s\n"), cmd, target);
1909 target) != 0) {
1924 if ((ret = traverse_attrfile(dp, source, target,
1933 * attribute file to copy to the target. The target has
1953 dp->d_name, source, target);
1965 /* Copy source file non default extended system attributes to target */
1971 "%s to %s\n"), cmd, source, target);
2006 /* Open source attribute dir, target and target attribute dir. */
2128 traverse_attrfile(struct dirent *dp, char *source, char *target, int first)
2173 target);
2186 target);
2200 " %s: "), cmd, dp->d_name, target);