X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Frm.c;h=e4e9bb0be48631471db33c38d58717d56aacb214;hb=843c5ef0f95e0a6f61f4e27d0355aca5e09ee6b1;hp=5489350e50ef3dc1d8815f30076f614a9fa21435;hpb=cad5364599eb5062d59e0c397ed638ddd61a8d5d;p=oweals%2Fbusybox.git diff --git a/coreutils/rm.c b/coreutils/rm.c index 5489350e5..e4e9bb0be 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c @@ -36,22 +36,16 @@ extern int rm_main(int argc, char **argv) { int status = 0; int flags = 0; - int opt; + unsigned long opt; - while ((opt = getopt(argc, argv, "fiRr")) > 0) { - if ((opt == 'r') || (opt == 'R')) { - flags |= FILEUTILS_RECUR; - } else { - flags &= ~(FILEUTILS_INTERACTIVE | FILEUTILS_FORCE); - if (opt == 'i') { - flags |= FILEUTILS_INTERACTIVE; - } else if (opt == 'f') { + bb_opt_complementally = "f-i:i-f"; + opt = bb_getopt_ulflags(argc, argv, "fiRr"); + if(opt & 1) flags |= FILEUTILS_FORCE; - } else { - bb_show_usage(); - } - } - } + if(opt & 2) + flags |= FILEUTILS_INTERACTIVE; + if(opt & 12) + flags |= FILEUTILS_RECUR; if (*(argv += optind) != NULL) { do {