diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-10-13 18:01:10 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-10-13 18:01:10 +0000 |
commit | c6cb79dedfb1af4ce64e75cd1c0d3cc1bfa71225 (patch) | |
tree | 685c18e7a6e52b315c9b8a142b8b21fc55e635fc /coreutils/cp.c | |
parent | 5de3065f5870526a68adee314fe181af976a9246 (diff) | |
download | busybox-w32-c6cb79dedfb1af4ce64e75cd1c0d3cc1bfa71225.tar.gz busybox-w32-c6cb79dedfb1af4ce64e75cd1c0d3cc1bfa71225.tar.bz2 busybox-w32-c6cb79dedfb1af4ce64e75cd1c0d3cc1bfa71225.zip |
More stuff
Diffstat (limited to 'coreutils/cp.c')
-rw-r--r-- | coreutils/cp.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 4cdfc843b..94b4ab024 100644 --- a/coreutils/cp.c +++ b/coreutils/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 | ||
54 | static 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, ×); | ||
83 | } | ||
84 | return TRUE; | ||
85 | } | ||
86 | |||
87 | extern int cp_main(int argc, char **argv) | 53 | extern int cp_main(int argc, char **argv) |
88 | { | 54 | { |
89 | 55 | ||