aboutsummaryrefslogtreecommitdiff
path: root/cp.c
diff options
context:
space:
mode:
authorerik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-12-29 02:36:29 +0000
committererik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-12-29 02:36:29 +0000
commitb075e176c84bb3a5518bbabc5172212886a763b5 (patch)
tree0eb9f4d1d08bde592fc79ef034990fd5c0788e25 /cp.c
parent44f4e93332fd720f2962fc4189a710c30a5cb7f6 (diff)
downloadbusybox-w32-b075e176c84bb3a5518bbabc5172212886a763b5.tar.gz
busybox-w32-b075e176c84bb3a5518bbabc5172212886a763b5.tar.bz2
busybox-w32-b075e176c84bb3a5518bbabc5172212886a763b5.zip
Fixed mv so it now does the right thing (same method used in cp). Removed
some cruft from cp. -Erik git-svn-id: svn://busybox.net/trunk/busybox@268 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'cp.c')
-rw-r--r--cp.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/cp.c b/cp.c
index 1e10f2868..83460190a 100644
--- a/cp.c
+++ b/cp.c
@@ -43,7 +43,6 @@ static int preserveFlag = FALSE;
43static const char *srcName; 43static const char *srcName;
44static const char *destName; 44static const char *destName;
45static int destDirFlag = FALSE; 45static int destDirFlag = FALSE;
46static int destExistsFlag = FALSE;
47static int srcDirFlag = FALSE; 46static int srcDirFlag = FALSE;
48 47
49static int fileAction(const char *fileName, struct stat* statbuf) 48static int fileAction(const char *fileName, struct stat* statbuf)
@@ -71,8 +70,6 @@ static int fileAction(const char *fileName, struct stat* statbuf)
71 70
72extern int cp_main(int argc, char **argv) 71extern int cp_main(int argc, char **argv)
73{ 72{
74 struct stat statBuf;
75
76 if (argc < 3) { 73 if (argc < 3) {
77 usage (cp_usage); 74 usage (cp_usage);
78 } 75 }
@@ -106,11 +103,7 @@ extern int cp_main(int argc, char **argv)
106 103
107 104
108 destName = argv[argc - 1]; 105 destName = argv[argc - 1];
109 if (stat(destName, &statBuf) >= 0) { 106 destDirFlag = isDirectory(destName);
110 destExistsFlag = TRUE;
111 if (S_ISDIR(statBuf.st_mode))
112 destDirFlag = TRUE;
113 }
114 107
115 if ((argc > 3) && destDirFlag==FALSE) { 108 if ((argc > 3) && destDirFlag==FALSE) {
116 fprintf(stderr, "%s: not a directory\n", destName); 109 fprintf(stderr, "%s: not a directory\n", destName);