Errors count to rmdir

This commit is contained in:
qorg11 2020-06-01 22:47:58 +02:00
parent 9077404b75
commit 83af9b4735
Signed by: qorg11
GPG Key ID: 343FC20A4ACA62B9
1 changed files with 8 additions and 2 deletions

View File

@ -3,13 +3,19 @@
int
main(int argc, char *argv[]) {
int errors = 0;
for(int i = 1; i<argc;i++)
{
int fd = rmdir(argv[i]); /* Is it actually a file descriptor? */
if(fd == -1)
{
fprintf(stderr,"Error removing dir %s\n",argv[i]);
}
fprintf(stderr,"Error removing dir %s\n",argv[i]);
errors++;
}
}
if(errors>0)
{
printf("%i error(s) found\n",errors);
}
return 0;
}