Changeset 684 for trunk/src/gmake/kmkbuiltin/rmdir.c
- Timestamp:
- Dec 8, 2006, 4:45:35 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/kmkbuiltin/rmdir.c
r603 r684 48 48 #include <stdlib.h> 49 49 #include <string.h> 50 #include <errno.h> 50 51 #ifndef _MSC_VER 51 52 #include <unistd.h> … … 60 61 static int pflag; 61 62 static int vflag; 63 static int ignore_fail_on_non_empty; 64 65 static struct option long_options[] = 66 { 67 { "ignore-fail-on-non-empty", no_argument, 0, 260 }, 68 { "parents", no_argument, 0, 'p' }, 69 { "verbose", no_argument, 0, 'v' }, 70 { 0, 0, 0, 0 }, 71 }; 72 62 73 63 74 int … … 67 78 68 79 /* reinitialize globals */ 69 vflag = 0;80 ignore_fail_on_non_empty = vflag = pflag = 0; 70 81 71 82 /* kmk: reset getopt and set progname */ … … 80 91 optind = 0; /* init */ 81 92 #endif 82 while ((ch = getopt (argc, argv, "pv")) != -1)93 while ((ch = getopt_long(argc, argv, "pv", long_options, NULL)) != -1) 83 94 switch(ch) { 84 95 case 'p': … … 87 98 case 'v': 88 99 vflag = 1; 100 break; 101 case 260: 102 ignore_fail_on_non_empty = 1; 89 103 break; 90 104 case '?': … … 100 114 for (errors = 0; *argv; argv++) { 101 115 if (rmdir(*argv) < 0) { 102 warn("%s", *argv); 103 errors = 1; 116 if (!ignore_fail_on_non_empty || errno != ENOTEMPTY) { 117 warn("%s", *argv); 118 errors = 1; 119 } 104 120 } else { 105 121 if (vflag) … … 146 162 147 163 if (rmdir(path) < 0) { 164 if (ignore_fail_on_non_empty && errno != ENOTEMPTY) 165 break; 148 166 warn("%s", path); 149 167 return (1);
Note:
See TracChangeset
for help on using the changeset viewer.