diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cp.c | 2 | ||||
-rw-r--r-- | coreutils/mv.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 57158c8..ce63201 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -54,6 +54,8 @@ static int fileAction(const char *fileName, struct stat* statbuf) strcat(newdestName, "/"); if ( skipName != NULL) strcat(newdestName, strstr(fileName, skipName)); + else + strcat(newdestName, srcName); } return (copyFile(fileName, newdestName, preserveFlag, followLinks)); } diff --git a/coreutils/mv.c b/coreutils/mv.c index b861ab7..2be3961 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c @@ -56,7 +56,7 @@ extern int mv_main(int argc, char **argv) fprintf(stderr, "%s: not a directory\n", destName); exit (FALSE); } - + while (argc-- > 1) { srcName = *(argv++); skipName = strrchr(srcName, '/'); @@ -67,6 +67,11 @@ extern int mv_main(int argc, char **argv) strcat(newdestName, "/"); if ( skipName != NULL) strcat(newdestName, strstr(srcName, skipName)); + else + strcat(newdestName, srcName); + fprintf(stderr, "srcName='%s'\n", srcName); + fprintf(stderr, "skipName='%s'\n", skipName); + fprintf(stderr, "newdestName='%s'\n", newdestName); } if (copyFile(srcName, newdestName, FALSE, FALSE) == FALSE) { exit( FALSE); |