Fixed "rm foo" that had been broken while implementing "rm -- foo"
This commit is contained in:
parent
1af7ed5573
commit
e97da40079
@ -61,7 +61,7 @@
|
|||||||
* Fixed segfault caused by "rm -f"
|
* Fixed segfault caused by "rm -f"
|
||||||
* Fixed segfault caused by "ln -s -s" and similar abuses.
|
* Fixed segfault caused by "ln -s -s" and similar abuses.
|
||||||
* Fixed segfault caused by "cp -a -a" and similar abuses.
|
* Fixed segfault caused by "cp -a -a" and similar abuses.
|
||||||
* Implemented "rm -- <foo>"
|
* Implemented "rm -- <foo>". Implementation fixed by Pavel Roskin.
|
||||||
* "which" rewritten to use stat(). Fixes to improve its compatability
|
* "which" rewritten to use stat(). Fixes to improve its compatability
|
||||||
with traditional implementations -- Pavel Roskin.
|
with traditional implementations -- Pavel Roskin.
|
||||||
* "mount" now reports errors from nfsmount() and assumes NFS mount
|
* "mount" now reports errors from nfsmount() and assumes NFS mount
|
||||||
|
@ -68,14 +68,12 @@ extern int rm_main(int argc, char **argv)
|
|||||||
int stopIt=FALSE;
|
int stopIt=FALSE;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (argc < 2) {
|
argc--;
|
||||||
usage(rm_usage);
|
|
||||||
}
|
|
||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
/* Parse any options */
|
/* Parse any options */
|
||||||
while (--argc >= 0 && *argv && **argv && stopIt==FALSE) {
|
while (argc > 0 && stopIt == FALSE) {
|
||||||
while (**argv == '-') {
|
if (**argv == '-') {
|
||||||
while (*++(*argv))
|
while (*++(*argv))
|
||||||
switch (**argv) {
|
switch (**argv) {
|
||||||
case 'R':
|
case 'R':
|
||||||
@ -91,8 +89,15 @@ extern int rm_main(int argc, char **argv)
|
|||||||
default:
|
default:
|
||||||
usage(rm_usage);
|
usage(rm_usage);
|
||||||
}
|
}
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
}
|
}
|
||||||
argv++;
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc < 1 && forceFlag == FALSE) {
|
||||||
|
usage(rm_usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc-- > 0) {
|
while (argc-- > 0) {
|
||||||
|
17
rm.c
17
rm.c
@ -68,14 +68,12 @@ extern int rm_main(int argc, char **argv)
|
|||||||
int stopIt=FALSE;
|
int stopIt=FALSE;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (argc < 2) {
|
argc--;
|
||||||
usage(rm_usage);
|
|
||||||
}
|
|
||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
/* Parse any options */
|
/* Parse any options */
|
||||||
while (--argc >= 0 && *argv && **argv && stopIt==FALSE) {
|
while (argc > 0 && stopIt == FALSE) {
|
||||||
while (**argv == '-') {
|
if (**argv == '-') {
|
||||||
while (*++(*argv))
|
while (*++(*argv))
|
||||||
switch (**argv) {
|
switch (**argv) {
|
||||||
case 'R':
|
case 'R':
|
||||||
@ -91,8 +89,15 @@ extern int rm_main(int argc, char **argv)
|
|||||||
default:
|
default:
|
||||||
usage(rm_usage);
|
usage(rm_usage);
|
||||||
}
|
}
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
}
|
}
|
||||||
argv++;
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc < 1 && forceFlag == FALSE) {
|
||||||
|
usage(rm_usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc-- > 0) {
|
while (argc-- > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user