Fixed "rm foo" that had been broken while implementing "rm -- foo"

This commit is contained in:
Pavel Roskin
2000-06-14 17:39:41 +00:00
parent 1af7ed5573
commit e97da40079
3 changed files with 23 additions and 13 deletions

View File

@ -68,14 +68,12 @@ extern int rm_main(int argc, char **argv)
int stopIt=FALSE;
struct stat statbuf;
if (argc < 2) {
usage(rm_usage);
}
argc--;
argv++;
/* Parse any options */
while (--argc >= 0 && *argv && **argv && stopIt==FALSE) {
while (**argv == '-') {
while (argc > 0 && stopIt == FALSE) {
if (**argv == '-') {
while (*++(*argv))
switch (**argv) {
case 'R':
@ -91,8 +89,15 @@ extern int rm_main(int argc, char **argv)
default:
usage(rm_usage);
}
argc--;
argv++;
}
argv++;
else
break;
}
if (argc < 1 && forceFlag == FALSE) {
usage(rm_usage);
}
while (argc-- > 0) {