diff options
author | Pavel Roskin <proski@gnu.org> | 2000-06-14 17:39:41 +0000 |
---|---|---|
committer | Pavel Roskin <proski@gnu.org> | 2000-06-14 17:39:41 +0000 |
commit | e97da4007913bd29d8a18d038de29d9d4549163d (patch) | |
tree | 7a8cb9dac9f84df0c155b63308135d8b7b282d70 | |
parent | 1af7ed5573de251690bae5ad70af1b3a6709457b (diff) | |
download | busybox-w32-e97da4007913bd29d8a18d038de29d9d4549163d.tar.gz busybox-w32-e97da4007913bd29d8a18d038de29d9d4549163d.tar.bz2 busybox-w32-e97da4007913bd29d8a18d038de29d9d4549163d.zip |
Fixed "rm foo" that had been broken while implementing "rm -- foo"
-rw-r--r-- | Changelog | 2 | ||||
-rw-r--r-- | coreutils/rm.c | 17 | ||||
-rw-r--r-- | rm.c | 17 |
3 files changed, 23 insertions, 13 deletions
@@ -61,7 +61,7 @@ | |||
61 | * Fixed segfault caused by "rm -f" | 61 | * Fixed segfault caused by "rm -f" |
62 | * Fixed segfault caused by "ln -s -s" and similar abuses. | 62 | * Fixed segfault caused by "ln -s -s" and similar abuses. |
63 | * Fixed segfault caused by "cp -a -a" and similar abuses. | 63 | * Fixed segfault caused by "cp -a -a" and similar abuses. |
64 | * Implemented "rm -- <foo>" | 64 | * Implemented "rm -- <foo>". Implementation fixed by Pavel Roskin. |
65 | * "which" rewritten to use stat(). Fixes to improve its compatability | 65 | * "which" rewritten to use stat(). Fixes to improve its compatability |
66 | with traditional implementations -- Pavel Roskin. | 66 | with traditional implementations -- Pavel Roskin. |
67 | * "mount" now reports errors from nfsmount() and assumes NFS mount | 67 | * "mount" now reports errors from nfsmount() and assumes NFS mount |
diff --git a/coreutils/rm.c b/coreutils/rm.c index 5901c5da9..b1cda3aed 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -68,14 +68,12 @@ extern int rm_main(int argc, char **argv) | |||
68 | int stopIt=FALSE; | 68 | int stopIt=FALSE; |
69 | struct stat statbuf; | 69 | struct stat statbuf; |
70 | 70 | ||
71 | if (argc < 2) { | 71 | argc--; |
72 | usage(rm_usage); | ||
73 | } | ||
74 | argv++; | 72 | argv++; |
75 | 73 | ||
76 | /* Parse any options */ | 74 | /* Parse any options */ |
77 | while (--argc >= 0 && *argv && **argv && stopIt==FALSE) { | 75 | while (argc > 0 && stopIt == FALSE) { |
78 | while (**argv == '-') { | 76 | if (**argv == '-') { |
79 | while (*++(*argv)) | 77 | while (*++(*argv)) |
80 | switch (**argv) { | 78 | switch (**argv) { |
81 | case 'R': | 79 | case 'R': |
@@ -91,8 +89,15 @@ extern int rm_main(int argc, char **argv) | |||
91 | default: | 89 | default: |
92 | usage(rm_usage); | 90 | usage(rm_usage); |
93 | } | 91 | } |
92 | argc--; | ||
93 | argv++; | ||
94 | } | 94 | } |
95 | argv++; | 95 | else |
96 | break; | ||
97 | } | ||
98 | |||
99 | if (argc < 1 && forceFlag == FALSE) { | ||
100 | usage(rm_usage); | ||
96 | } | 101 | } |
97 | 102 | ||
98 | while (argc-- > 0) { | 103 | while (argc-- > 0) { |
@@ -68,14 +68,12 @@ extern int rm_main(int argc, char **argv) | |||
68 | int stopIt=FALSE; | 68 | int stopIt=FALSE; |
69 | struct stat statbuf; | 69 | struct stat statbuf; |
70 | 70 | ||
71 | if (argc < 2) { | 71 | argc--; |
72 | usage(rm_usage); | ||
73 | } | ||
74 | argv++; | 72 | argv++; |
75 | 73 | ||
76 | /* Parse any options */ | 74 | /* Parse any options */ |
77 | while (--argc >= 0 && *argv && **argv && stopIt==FALSE) { | 75 | while (argc > 0 && stopIt == FALSE) { |
78 | while (**argv == '-') { | 76 | if (**argv == '-') { |
79 | while (*++(*argv)) | 77 | while (*++(*argv)) |
80 | switch (**argv) { | 78 | switch (**argv) { |
81 | case 'R': | 79 | case 'R': |
@@ -91,8 +89,15 @@ extern int rm_main(int argc, char **argv) | |||
91 | default: | 89 | default: |
92 | usage(rm_usage); | 90 | usage(rm_usage); |
93 | } | 91 | } |
92 | argc--; | ||
93 | argv++; | ||
94 | } | 94 | } |
95 | argv++; | 95 | else |
96 | break; | ||
97 | } | ||
98 | |||
99 | if (argc < 1 && forceFlag == FALSE) { | ||
100 | usage(rm_usage); | ||
96 | } | 101 | } |
97 | 102 | ||
98 | while (argc-- > 0) { | 103 | while (argc-- > 0) { |