Lines Matching refs:dst

50 static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options…
98 static void printCopyMsg(const char* src, const char* dst, unsigned int options) in printCopyMsg() argument
101 printf(" '%s' --> '%s'\n", src, dst); in printCopyMsg()
104 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()
309 dstRsrcName = malloc(strlen(dst) + 5 + 1); in copyRegular()
310 strcpy(dstRsrcName, dst); in copyRegular()
338 setPermissions(dst, pSrcStat, options); in copyRegular()
340 printCopyMsg(src, dst, options); in copyRegular()
355 extern int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int …
362 static int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int … in copySymlink() argument
369 DBUG(("--- copying symlink '%s' to '%s'\n", src, dst)); in copySymlink()
372 statResult = lstat(dst, &dstStat); in copySymlink()
379 dst); in copySymlink()
386 src, dst); in copySymlink()
392 printNotNewerMsg(src, dst, options); in copySymlink()
406 DBUG(("--- creating symlink file '%s' (--> %s)\n", dst, linkBuf)); in copySymlink()
409 DBUG(("--- removing '%s'\n", dst)); in copySymlink()
410 if (unlink(dst) != 0) { in copySymlink()
412 dst, strerror(errno)); in copySymlink()
417 if (symlink(linkBuf, dst) != 0) { in copySymlink()
419 dst, linkBuf, strerror(errno)); in copySymlink()
428 if (lchown(dst, pSrcStat->st_uid, pSrcStat->st_gid) != 0) in copySymlink()
432 printCopyMsg(src, dst, options); in copySymlink()
442 int copyDirectory(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int optio… in copyDirectory() argument
449 DBUG(("--- copy dir '%s' to '%s'\n", src, dst)); in copyDirectory()
451 statResult = stat(dst, &dstStat); in copyDirectory()
454 "acp: destination '%s' exists and is not a directory\n", dst); in copyDirectory()
457 fprintf(stderr, "acp: unable to stat destination '%s'\n", dst); in copyDirectory()
465 src, dst); in copyDirectory()
469 DBUG(("--- creating dir '%s'\n", dst)); in copyDirectory()
470 cc = mkdir(dst, 0755); in copyDirectory()
473 dst, strerror(errno)); in copyDirectory()
478 printCopyMsg(src, dst, options); in copyDirectory()
509 dstLen = strlen(dst); in copyDirectory()
517 memcpy(dstFile, dst, dstLen); in copyDirectory()
529 setPermissions(dst, pSrcStat, options); in copyDirectory()
541 static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options) in copyFileRecursive() argument
580 retVal = copyDirectory(src, dst, &srcStat, options); in copyFileRecursive()
584 retVal = copySymlink(src, dst, &srcStat, options); in copyFileRecursive()
587 retVal = copyRegular(src, dst, &srcStat, options); in copyFileRecursive()
601 int copyFile(const char* src, const char* dst, unsigned int options) in copyFile() argument
603 return copyFileRecursive(src, dst, true, options); in copyFile()