1 /* vi: set sw=4 ts=4: */
3 * Mini rm implementation for busybox
5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
10 /* BB_AUDIT SUSv3 compliant */
11 /* http://www.opengroup.org/onlinepubs/007904975/utilities/rm.html */
13 /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
20 /* This is a NOFORK applet. Be very careful! */
22 int rm_main(int argc
, char **argv
);
23 int rm_main(int argc
, char **argv
)
29 opt_complementary
= "f-i:i-f";
30 opt
= getopt32(argc
, argv
, "fiRr");
33 flags
|= FILEUTILS_FORCE
;
35 flags
|= FILEUTILS_INTERACTIVE
;
37 flags
|= FILEUTILS_RECUR
;
41 const char *base
= bb_get_last_path_component(*argv
);
43 if (DOT_OR_DOTDOT(base
)) {
44 bb_error_msg("cannot remove '.' or '..'");
45 } else if (remove_file(*argv
, flags
) >= 0) {
50 } else if (!(flags
& FILEUTILS_FORCE
)) {