diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 1999-10-14 22:16:57 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 1999-10-14 22:16:57 +0000 |
commit | fd924d90c1fdac2f9cd33e065c7aa540d0f65167 (patch) | |
tree | 4c67645bbc6677ad2217da3cdf6c0a748e0ca88d /cp.c | |
parent | 60212983eee6fa075c664eef284a45c5c986bfa2 (diff) | |
download | busybox-w32-fd924d90c1fdac2f9cd33e065c7aa540d0f65167.tar.gz busybox-w32-fd924d90c1fdac2f9cd33e065c7aa540d0f65167.tar.bz2 busybox-w32-fd924d90c1fdac2f9cd33e065c7aa540d0f65167.zip |
Fixed cp -[aR] and some other stuf.
git-svn-id: svn://busybox.net/trunk/busybox@27 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'cp.c')
-rw-r--r-- | cp.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -40,13 +40,14 @@ static int followLinks = FALSE; | |||
40 | static int preserveFlag = FALSE; | 40 | static int preserveFlag = FALSE; |
41 | static const char *srcName; | 41 | static const char *srcName; |
42 | static const char *destName; | 42 | static const char *destName; |
43 | static const char *skipName; | ||
43 | 44 | ||
44 | 45 | ||
45 | static int fileAction(const char *fileName) | 46 | static int fileAction(const char *fileName) |
46 | { | 47 | { |
47 | char newdestName[NAME_MAX]; | 48 | char newdestName[NAME_MAX]; |
48 | strcpy(newdestName, destName); | 49 | strcpy(newdestName, destName); |
49 | strcat(newdestName, fileName+(strlen(srcName))); | 50 | strcat(newdestName, strstr(fileName, skipName)); |
50 | return (copyFile(fileName, newdestName, preserveFlag, followLinks)); | 51 | return (copyFile(fileName, newdestName, preserveFlag, followLinks)); |
51 | } | 52 | } |
52 | 53 | ||
@@ -98,10 +99,13 @@ extern int cp_main(int argc, char **argv) | |||
98 | exit (FALSE); | 99 | exit (FALSE); |
99 | } | 100 | } |
100 | 101 | ||
101 | while (argc-- >= 2) { | 102 | while (argc-- > 1) { |
102 | srcName = *(argv++); | 103 | srcName = *(argv++); |
103 | exit( recursiveAction(srcName, recursiveFlag, followLinks, | 104 | skipName = strrchr(srcName, '/'); |
104 | fileAction, fileAction)); | 105 | if (skipName) skipName++; |
106 | if (recursiveAction(srcName, recursiveFlag, followLinks, | ||
107 | fileAction, fileAction) == FALSE) | ||
108 | exit( FALSE); | ||
105 | } | 109 | } |
106 | exit( TRUE); | 110 | exit( TRUE); |
107 | } | 111 | } |