aboutsummaryrefslogtreecommitdiff
path: root/cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'cp.c')
-rw-r--r--cp.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/cp.c b/cp.c
index 4cdfc843b..94b4ab024 100644
--- a/cp.c
+++ b/cp.c
@@ -47,43 +47,9 @@ static int fileAction(const char *fileName)
47 char newdestName[NAME_MAX]; 47 char newdestName[NAME_MAX];
48 strcpy(newdestName, destName); 48 strcpy(newdestName, destName);
49 strcat(newdestName, fileName+(strlen(srcName))); 49 strcat(newdestName, fileName+(strlen(srcName)));
50 fprintf(stderr, "A: copying %s to %s\n", fileName, newdestName);
51 return (copyFile(fileName, newdestName, preserveFlag, followLinks)); 50 return (copyFile(fileName, newdestName, preserveFlag, followLinks));
52} 51}
53 52
54static int dirAction(const char *fileName)
55{
56 char newdestName[NAME_MAX];
57 struct stat statBuf;
58 struct utimbuf times;
59
60 strcpy(newdestName, destName);
61 strcat(newdestName, fileName+(strlen(srcName)));
62 if (stat(newdestName, &statBuf)) {
63 if (mkdir( newdestName, 0777777 ^ umask (0))) {
64 perror(newdestName);
65 return( FALSE);
66 }
67 }
68 else if (!S_ISDIR (statBuf.st_mode)) {
69 fprintf(stderr, "`%s' exists but is not a directory", newdestName);
70 return( FALSE);
71 }
72 if (preserveFlag==TRUE) {
73 /* Try to preserve premissions, but don't whine on failure */
74 if (stat(newdestName, &statBuf)) {
75 perror(newdestName);
76 return( FALSE);
77 }
78 chmod(newdestName, statBuf.st_mode);
79 chown(newdestName, statBuf.st_uid, statBuf.st_gid);
80 times.actime = statBuf.st_atime;
81 times.modtime = statBuf.st_mtime;
82 utime(newdestName, &times);
83 }
84 return TRUE;
85}
86
87extern int cp_main(int argc, char **argv) 53extern int cp_main(int argc, char **argv)
88{ 54{
89 55