Lines Matching refs:dst
52 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
107 printf(" '%s' is up-to-date\n", dst); in printNotNewerMsg()
115 static int copyFileContents(const char* dst, int dstFd, const char* src, int srcFd) in copyFileContents() argument
135 "acp: failed writing '%s': %s\n", dst, strerror(errno)); in copyFileContents()
140 dst, writeCount, readCount); in copyFileContents()
159 static int setPermissions(const char* dst, const struct stat* pSrcStat, unsigned int options) in setPermissions() argument
172 if (utime(dst, &ut) != 0) { in setPermissions()
174 dst, strerror(errno))); in setPermissions()
182 if (chmod(dst, pSrcStat->st_mode & ~(S_IFMT)) != 0) { in setPermissions()
184 dst, pSrcStat->st_mode & ~(S_IFMT), strerror(errno))); in setPermissions()
190 if (chown(dst, pSrcStat->st_uid, pSrcStat->st_gid) != 0) { in setPermissions()
192 dst, pSrcStat->st_uid, pSrcStat->st_gid, strerror(errno))); in setPermissions()
208 static int copyRegular(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int … in copyRegular() argument
213 DBUG(("--- copying regular '%s' to '%s'\n", src, dst)); in copyRegular()
215 statResult = stat(dst, &dstStat); in copyRegular()
219 dst); in copyRegular()
222 fprintf(stderr, "acp: unable to stat destination '%s'\n", dst); in copyRegular()
229 src, dst); in copyRegular()
235 printNotNewerMsg(src, dst, options); in copyRegular()
249 DBUG(("--- opening '%s'\n", dst)); in copyRegular()
250 dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644); in copyRegular()
256 "acp: cannot create '%s': %s\n", dst, strerror(errno)); in copyRegular()
263 if (unlink(dst) != 0) { in copyRegular()
268 if (chmod(dst, S_IWRITE|S_IREAD) == 0 && unlink(dst) == 0) in copyRegular()
273 dst, strerror(errno)); in copyRegular()
280 dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644); in copyRegular()
285 dst, strerror(errno)); in copyRegular()
290 copyResult = copyFileContents(dst, dstFd, src, srcFd); in copyRegular()
307 dstRsrcName = malloc(strlen(dst) + 5 + 1); in copyRegular()
308 strcpy(dstRsrcName, dst); in copyRegular()
333 setPermissions(dst, pSrcStat, options); in copyRegular()
335 printCopyMsg(src, dst, options); in copyRegular()
350 extern int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int …
352 static int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int … in copySymlink() argument
359 DBUG(("--- copying symlink '%s' to '%s'\n", src, dst)); in copySymlink()
362 statResult = lstat(dst, &dstStat); in copySymlink()
369 dst); in copySymlink()
376 src, dst); in copySymlink()
382 printNotNewerMsg(src, dst, options); in copySymlink()
396 DBUG(("--- creating symlink file '%s' (--> %s)\n", dst, linkBuf)); in copySymlink()
399 DBUG(("--- removing '%s'\n", dst)); in copySymlink()
400 if (unlink(dst) != 0) { in copySymlink()
402 dst, strerror(errno)); in copySymlink()
407 if (symlink(linkBuf, dst) != 0) { in copySymlink()
409 dst, linkBuf, strerror(errno)); in copySymlink()
418 if (lchown(dst, pSrcStat->st_uid, pSrcStat->st_gid) != 0) in copySymlink()
422 printCopyMsg(src, dst, options); in copySymlink()
432 int copyDirectory(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int optio… in copyDirectory() argument
439 DBUG(("--- copy dir '%s' to '%s'\n", src, dst)); in copyDirectory()
441 statResult = stat(dst, &dstStat); in copyDirectory()
444 "acp: destination '%s' exists and is not a directory\n", dst); in copyDirectory()
447 fprintf(stderr, "acp: unable to stat destination '%s'\n", dst); in copyDirectory()
455 src, dst); in copyDirectory()
459 DBUG(("--- creating dir '%s'\n", dst)); in copyDirectory()
460 cc = mkdir(dst, 0755); in copyDirectory()
463 dst, strerror(errno)); in copyDirectory()
468 printCopyMsg(src, dst, options); in copyDirectory()
499 dstLen = strlen(dst); in copyDirectory()
507 memcpy(dstFile, dst, dstLen); in copyDirectory()
519 setPermissions(dst, pSrcStat, options); in copyDirectory()
531 static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options) in copyFileRecursive() argument
589 dstExe = malloc(strlen(dst) + 4 +1); in copyFileRecursive()
590 strcpy(dstExe, dst); in copyFileRecursive()
594 dst = dstExe; in copyFileRecursive()
620 retVal = copyDirectory(src, dst, &srcStat, options); in copyFileRecursive()
623 retVal = copySymlink(src, dst, &srcStat, options); in copyFileRecursive()
625 retVal = copyRegular(src, dst, &srcStat, options); in copyFileRecursive()
639 int copyFile(const char* src, const char* dst, unsigned int options) in copyFile() argument
641 return copyFileRecursive(src, dst, true, options); in copyFile()