2
* Copyright (c) 2017 Denys Vlasenko <vda.linux@googlemail.com>
4
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
10
//config: Alias to "rm -rf".
12
//applet:IF_NUKE(APPLET_NOEXEC(nuke, nuke, BB_DIR_BIN, BB_SUID_DROP, nuke))
14
//kbuild:lib-$(CONFIG_NUKE) += nuke.o
16
//usage:#define nuke_trivial_usage
18
//usage:#define nuke_full_usage "\n\n"
19
//usage: "Resursively remove DIRs"
23
/* This is a NOEXEC applet. Be very careful! */
25
int nuke_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
26
int nuke_main(int argc UNUSED_PARAM, char **argv)
28
// klibc-utils do not check opts, will try to delete "-dir" args
29
//opt = getopt32(argv, "");
34
// klibc-utils do not check this, will happily operate on ".."
35
const char *base = bb_get_last_path_component_strip(*argv);
36
if (DOT_OR_DOTDOT(base)) {
37
bb_error_msg("can't remove '.' or '..'");
41
remove_file(*argv, FILEUTILS_FORCE | FILEUTILS_RECUR);
44
// klibc-utils do not indicate errors