aboutsummaryrefslogtreecommitdiff
path: root/cp.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-10-14 22:16:57 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-10-14 22:16:57 +0000
commitfd924d90c1fdac2f9cd33e065c7aa540d0f65167 (patch)
tree4c67645bbc6677ad2217da3cdf6c0a748e0ca88d /cp.c
parent60212983eee6fa075c664eef284a45c5c986bfa2 (diff)
downloadbusybox-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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/cp.c b/cp.c
index 94b4ab024..6ca66e642 100644
--- a/cp.c
+++ b/cp.c
@@ -40,13 +40,14 @@ static int followLinks = FALSE;
40static int preserveFlag = FALSE; 40static int preserveFlag = FALSE;
41static const char *srcName; 41static const char *srcName;
42static const char *destName; 42static const char *destName;
43static const char *skipName;
43 44
44 45
45static int fileAction(const char *fileName) 46static 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}