Refactor rmdir

Use arg.h- and pointer-iterator-idioms.
This commit is contained in:
FRIGN 2014-06-09 21:03:42 +02:00 committed by sin
parent 612e09af7e
commit 8f7bc0db35

15
rmdir.c
View File

@ -15,15 +15,18 @@ usage(void)
int
main(int argc, char *argv[])
{
argv++;;
if(!*argv)
ARGBEGIN {
default:
usage();
} ARGEND;
if (argc < 1)
usage();
while(*argv) {
if(rmdir(*argv++) == -1)
for(; argc > 0; argc--, argv++)
if(rmdir(argv[0]) == -1)
fprintf(stderr, "rmdir: '%s': %s\n",
argv[-1], strerror(errno));
}
argv[0], strerror(errno));
return EXIT_SUCCESS;
}