rm: removing empty dirs is okay

This commit is contained in:
Connor Lane Smith 2012-05-25 21:55:31 +01:00
parent 20d526391d
commit 196e81c5fb

10
rm.c
View File

@ -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
rm(argv[optind]);
}
for(; optind < argc; optind++)
rm(argv[optind]);
return EXIT_SUCCESS;
}