aboutsummaryrefslogtreecommitdiff
path: root/coreutils/cp.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-10-14 22:16:57 +0000
committerEric Andersen <andersen@codepoet.org>1999-10-14 22:16:57 +0000
commit3c163822d88105450806fdb6a29fdfc2511267d1 (patch)
tree4c67645bbc6677ad2217da3cdf6c0a748e0ca88d /coreutils/cp.c
parent2c1030177e0a6f849ba557400e3e4867de455ce9 (diff)
downloadbusybox-3c163822d88105450806fdb6a29fdfc2511267d1.tar.gz
Fixed cp -[aR] and some other stuf.
Diffstat (limited to 'coreutils/cp.c')
-rw-r--r--coreutils/cp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c
index 94b4ab024..6ca66e642 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -40,13 +40,14 @@ static int followLinks = FALSE;
static int preserveFlag = FALSE;
static const char *srcName;
static const char *destName;
+static const char *skipName;
static int fileAction(const char *fileName)
{
char newdestName[NAME_MAX];
strcpy(newdestName, destName);
- strcat(newdestName, fileName+(strlen(srcName)));
+ strcat(newdestName, strstr(fileName, skipName));
return (copyFile(fileName, newdestName, preserveFlag, followLinks));
}
@@ -98,10 +99,13 @@ extern int cp_main(int argc, char **argv)
exit (FALSE);
}
- while (argc-- >= 2) {
+ while (argc-- > 1) {
srcName = *(argv++);
- exit( recursiveAction(srcName, recursiveFlag, followLinks,
- fileAction, fileAction));
+ skipName = strrchr(srcName, '/');
+ if (skipName) skipName++;
+ if (recursiveAction(srcName, recursiveFlag, followLinks,
+ fileAction, fileAction) == FALSE)
+ exit( FALSE);
}
exit( TRUE);
}