source: trunk/minix/commands/simple/rmdir.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 642 bytes
Line 
1/* rmdir - remove directory. Author: Kees J. Bot
2 */
3#define nil 0
4#include <sys/types.h>
5#include <stddef.h>
6#include <stdlib.h>
7#include <string.h>
8#include <unistd.h>
9#include <errno.h>
10
11void tell(char *what)
12{
13 write(2, what, strlen(what));
14}
15
16void report(char *label)
17{
18 char *err= strerror(errno);
19
20 tell("rmdir: ");
21 tell(label);
22 tell(": ");
23 tell(err);
24 tell("\n");
25}
26
27int main(int argc, char **argv)
28{
29 int i, ex= 0;
30
31 if (argc < 2) {
32 tell("Usage: rmdir directory ...\n");
33 exit(1);
34 }
35
36 i=1;
37 do {
38 if (rmdir(argv[i]) < 0) {
39 report(argv[i]);
40 ex= 1;
41 }
42 } while (++i < argc);
43
44 exit(ex);
45}
46/* Kees J. Bot 27-12-90. */
Note: See TracBrowser for help on using the repository browser.