bore

basic core utilities (PD)
git clone git://bvnf.space/bore.git
Log | Files | Refs | README

rmdir.c (428B)


      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
#define _XOPEN_SOURCE 700
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int
main(int argc, char **argv) {
    if (argc == 1) {
        fprintf(stderr, "usage: %s dir...\n", *argv);
        return 1;
    }

    while (*++argv != NULL) {
        if (rmdir(*argv) != 0) {
            fprintf(stderr, "rmdir: %s: %s\n", *argv, strerror(errno));
            return 1;
        }
    }
    return 0;
}