Lines Matching refs:dst
51 static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options…
99 static void printCopyMsg(const char* src, const char* dst, unsigned int options) in printCopyMsg() argument
102 printf(" '%s' --> '%s'\n", src, dst); in printCopyMsg()
105 static void printNotNewerMsg(const char* src, const char* dst, unsigned int options) in printNotNewerMsg() argument
108 printf(" '%s' is up-to-date\n", dst); in printNotNewerMsg()
116 static int copyFileContents(const char* dst, int dstFd, const char* src, int srcFd) in copyFileContents() argument
136 "acp: failed writing '%s': %s\n", dst, strerror(errno)); in copyFileContents()
141 dst, writeCount, readCount); in copyFileContents()
160 static int setPermissions(const char* dst, const struct stat* pSrcStat, unsigned int options) in setPermissions() argument
173 if (utime(dst, &ut) != 0) { in setPermissions()
175 dst, strerror(errno))); in setPermissions()
183 if (chmod(dst, pSrcStat->st_mode & ~(S_IFMT)) != 0) { in setPermissions()
185 dst, pSrcStat->st_mode & ~(S_IFMT), strerror(errno))); in setPermissions()
191 if (chown(dst, pSrcStat->st_uid, pSrcStat->st_gid) != 0) { in setPermissions()
193 dst, pSrcStat->st_uid, pSrcStat->st_gid, strerror(errno))); in setPermissions()
209 static int copyRegular(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int … in copyRegular() argument
214 DBUG(("--- copying regular '%s' to '%s'\n", src, dst)); in copyRegular()
216 statResult = stat(dst, &dstStat); in copyRegular()
220 dst); in copyRegular()
223 fprintf(stderr, "acp: unable to stat destination '%s'\n", dst); in copyRegular()
230 src, dst); in copyRegular()
236 printNotNewerMsg(src, dst, options); in copyRegular()
250 DBUG(("--- opening '%s'\n", dst)); in copyRegular()
251 dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644); in copyRegular()
257 "acp: cannot create '%s': %s\n", dst, strerror(errno)); in copyRegular()
264 if (unlink(dst) != 0) { in copyRegular()
269 if (chmod(dst, S_IWRITE|S_IREAD) == 0 && unlink(dst) == 0) in copyRegular()
274 dst, strerror(errno)); in copyRegular()
281 dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644); in copyRegular()
286 dst, strerror(errno)); in copyRegular()
291 copyResult = copyFileContents(dst, dstFd, src, srcFd); in copyRegular()
308 dstRsrcName = malloc(strlen(dst) + 5 + 1); in copyRegular()
309 strcpy(dstRsrcName, dst); in copyRegular()
334 setPermissions(dst, pSrcStat, options); in copyRegular()
336 printCopyMsg(src, dst, options); in copyRegular()
351 static int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int … in copySymlink() argument
358 DBUG(("--- copying symlink '%s' to '%s'\n", src, dst)); in copySymlink()
361 statResult = lstat(dst, &dstStat); in copySymlink()
368 dst); in copySymlink()
375 src, dst); in copySymlink()
381 printNotNewerMsg(src, dst, options); in copySymlink()
395 DBUG(("--- creating symlink file '%s' (--> %s)\n", dst, linkBuf)); in copySymlink()
398 DBUG(("--- removing '%s'\n", dst)); in copySymlink()
399 if (unlink(dst) != 0) { in copySymlink()
401 dst, strerror(errno)); in copySymlink()
406 if (symlink(linkBuf, dst) != 0) { in copySymlink()
408 dst, linkBuf, strerror(errno)); in copySymlink()
417 if (lchown(dst, pSrcStat->st_uid, pSrcStat->st_gid) != 0) in copySymlink()
421 printCopyMsg(src, dst, options); in copySymlink()
431 int copyDirectory(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int optio… in copyDirectory() argument
438 DBUG(("--- copy dir '%s' to '%s'\n", src, dst)); in copyDirectory()
440 statResult = stat(dst, &dstStat); in copyDirectory()
443 "acp: destination '%s' exists and is not a directory\n", dst); in copyDirectory()
446 fprintf(stderr, "acp: unable to stat destination '%s'\n", dst); in copyDirectory()
454 src, dst); in copyDirectory()
458 DBUG(("--- creating dir '%s'\n", dst)); in copyDirectory()
459 cc = mkdir(dst, 0755); in copyDirectory()
462 dst, strerror(errno)); in copyDirectory()
467 printCopyMsg(src, dst, options); in copyDirectory()
498 dstLen = strlen(dst); in copyDirectory()
506 memcpy(dstFile, dst, dstLen); in copyDirectory()
518 setPermissions(dst, pSrcStat, options); in copyDirectory()
530 static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options) in copyFileRecursive() argument
588 dstExe = malloc(strlen(dst) + 4 +1); in copyFileRecursive()
589 strcpy(dstExe, dst); in copyFileRecursive()
593 dst = dstExe; in copyFileRecursive()
619 retVal = copyDirectory(src, dst, &srcStat, options); in copyFileRecursive()
623 retVal = copySymlink(src, dst, &srcStat, options); in copyFileRecursive()
626 retVal = copyRegular(src, dst, &srcStat, options); in copyFileRecursive()
640 int copyFile(const char* src, const char* dst, unsigned int options) in copyFile() argument
642 return copyFileRecursive(src, dst, true, options); in copyFile()