Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/coreutils/rm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 532 by niro, Sat Sep 1 22:45:15 2007 UTC revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC
# Line 15  Line 15 
15   * Size reduction.   * Size reduction.
16   */   */
17    
18  #include <unistd.h>  #include "libbb.h"
 #include "busybox.h"  
19    
20  int rm_main(int argc, char **argv)  /* This is a NOFORK applet. Be very careful! */
21    
22    int rm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
23    int rm_main(int argc UNUSED_PARAM, char **argv)
24  {  {
25   int status = 0;   int status = 0;
26   int flags = 0;   int flags = 0;
27   unsigned opt;   unsigned opt;
28    
29   opt_complementary = "f-i:i-f";   opt_complementary = "f-i:i-f";
30   opt = getopt32(argc, argv, "fiRr");   opt = getopt32(argv, "fiRr");
31   if(opt & 1)   argv += optind;
32   flags |= FILEUTILS_FORCE;   if (opt & 1)
33   if(opt & 2)   flags |= FILEUTILS_FORCE;
34     if (opt & 2)
35   flags |= FILEUTILS_INTERACTIVE;   flags |= FILEUTILS_INTERACTIVE;
36   if(opt & 12)   if (opt & 12)
37   flags |= FILEUTILS_RECUR;   flags |= FILEUTILS_RECUR;
38    
39   if (*(argv += optind) != NULL) {   if (*argv != NULL) {
40   do {   do {
41   const char *base = bb_get_last_path_component(*argv);   const char *base = bb_get_last_path_component_strip(*argv);
42    
43   if ((base[0] == '.') && (!base[1] || ((base[1] == '.') && !base[2]))) {   if (DOT_OR_DOTDOT(base)) {
44   bb_error_msg("cannot remove '.' or '..'");   bb_error_msg("cannot remove '.' or '..'");
45   } else if (remove_file(*argv, flags) >= 0) {   } else if (remove_file(*argv, flags) >= 0) {
46   continue;   continue;

Legend:
Removed from v.532  
changed lines
  Added in v.816