Lines Matching defs:src

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)
102 printf(" '%s' --> '%s'\n", src, dst);
105 static void printNotNewerMsg(const char* src, const char* dst, unsigned int options)
116 static int copyFileContents(const char* dst, int dstFd, const char* src, int srcFd)
128 "acp: failed reading '%s': %s\n", src, strerror(errno));
209 static int copyRegular(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
214 DBUG(("--- copying regular '%s' to '%s'\n", src, dst));
230 src, dst);
235 DBUG(("--- source is not newer: '%s'\n", src));
236 printNotNewerMsg(src, dst, options);
242 /* open src */
243 srcFd = open(src, O_RDONLY | O_BINARY, 0);
245 fprintf(stderr, "acp: unable to open '%s': %s\n", src, strerror(errno));
291 copyResult = copyFileContents(dst, dstFd, src, srcFd);
304 srcRsrcName = malloc(strlen(src) + 5 + 1);
305 strcpy(srcRsrcName, src);
336 printCopyMsg(src, dst, options);
351 static int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
358 DBUG(("--- copying symlink '%s' to '%s'\n", src, dst));
375 src, dst);
380 DBUG(("--- source is not newer: '%s'\n", src));
381 printNotNewerMsg(src, dst, options);
388 nameLen = readlink(src, linkBuf, sizeof(linkBuf)-1);
391 src, strerror(errno));
421 printCopyMsg(src, dst, options);
428 * Copy the contents of one directory to another. Both "src" and "dst"
431 int copyDirectory(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
438 DBUG(("--- copy dir '%s' to '%s'\n", src, dst));
454 src, dst);
467 printCopyMsg(src, dst, options);
473 dir = opendir(src);
476 src, strerror(errno));
497 srcLen = strlen(src);
501 memcpy(srcFile, src, srcLen);
526 * "dst" should only be a directory if "src" is also a directory.
530 static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options)
543 statResult = lstat(src, &srcStat);
545 statResult = stat(src, &srcStat);
561 tmpFd = open(src, O_RDONLY | O_BINARY, 0);
574 srcExe = malloc(strlen(src) + 4 +1);
575 strcpy(srcExe, src);
592 src = srcExe;
601 fprintf(stderr, "acp: file '%s' does not exist\n", src);
604 src, strerror(statErrno));
610 * If "src" is a directory, ignore it if "recursive" isn't set.
617 fprintf(stderr, "acp: omitting directory '%s'\n", src);
619 retVal = copyDirectory(src, dst, &srcStat, options);
623 retVal = copySymlink(src, dst, &srcStat, options);
626 retVal = copyRegular(src, dst, &srcStat, options);
629 src, srcStat.st_mode);
640 int copyFile(const char* src, const char* dst, unsigned int options)
642 return copyFileRecursive(src, dst, true, options);