rm: removing empty dirs is okay
This commit is contained in:
parent
20d526391d
commit
196e81c5fb
8
rm.c
8
rm.c
|
@ -11,7 +11,6 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
char c;
|
||||
struct stat st;
|
||||
|
||||
while((c = getopt(argc, argv, "fr")) != -1)
|
||||
switch(c) {
|
||||
|
@ -24,12 +23,7 @@ main(int argc, char *argv[])
|
|||
default:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
for(; optind < argc; optind++) {
|
||||
if(!rm_rflag && stat(argv[optind], &st) == 0 &&
|
||||
S_ISDIR(st.st_mode))
|
||||
fprintf(stderr, "%s: is a directory\n", argv[optind]);
|
||||
else
|
||||
for(; optind < argc; optind++)
|
||||
rm(argv[optind]);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user