X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Frm.c;h=975f2267b1f219cfd427601b2707e0654c0b009f;hb=5b492ee87614632e7bf5cd68fe0ce87dad30002a;hp=61e3e7010a59e6f9f489238a0fc4c23a241e243d;hpb=51742f4bb0c57a4d5063ece9437a2f34a42e52c8;p=oweals%2Fbusybox.git diff --git a/coreutils/rm.c b/coreutils/rm.c index 61e3e7010..975f2267b 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c @@ -15,19 +15,19 @@ * Size reduction. */ -#include "busybox.h" +#include "libbb.h" /* This is a NOFORK applet. Be very careful! */ -int rm_main(int argc, char **argv); -int rm_main(int argc, char **argv) +int rm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +int rm_main(int argc UNUSED_PARAM, char **argv) { int status = 0; int flags = 0; unsigned opt; opt_complementary = "f-i:i-f"; - opt = getopt32(argc, argv, "fiRr"); + opt = getopt32(argv, "fiRr"); argv += optind; if (opt & 1) flags |= FILEUTILS_FORCE; @@ -38,9 +38,9 @@ int rm_main(int argc, char **argv) if (*argv != NULL) { do { - const char *base = bb_get_last_path_component(*argv); + const char *base = bb_get_last_path_component_strip(*argv); - if ((base[0] == '.') && (!base[1] || ((base[1] == '.') && !base[2]))) { + if (DOT_OR_DOTDOT(base)) { bb_error_msg("cannot remove '.' or '..'"); } else if (remove_file(*argv, flags) >= 0) { continue;