290
|
1 /* vi: set sw=4 ts=4:
|
|
2 *
|
|
3 * hello.c - A hello world program.
|
|
4 *
|
|
5 * Copyright 2006 Rob Landley <rob@landley.net>
|
|
6 *
|
|
7 * See http://www.opengroup.org/onlinepubs/009695399/utilities/cat.html
|
|
8
|
|
9 USE_RMDIR(NEWTOY(rmdir, "<1p", TOYFLAG_BIN))
|
|
10
|
|
11 config RMDIR
|
|
12 bool "rmdir"
|
|
13 default y
|
|
14 help
|
|
15 usage: rmdir [-p] [dirname...]
|
|
16 Remove one or more directories.
|
|
17
|
|
18 -p Remove path.
|
|
19 */
|
|
20
|
|
21 #include "toys.h"
|
|
22
|
|
23 static void do_rmdir(char *name)
|
|
24 {
|
|
25 for (;;) {
|
|
26 char *temp;
|
|
27
|
|
28 if (rmdir(name)) {
|
|
29 perror_msg("%s",name);
|
|
30 return;
|
|
31 }
|
|
32 if (!toys.optflags) return;
|
|
33 if (!(temp=strrchr(name,'/'))) return;
|
|
34 *temp=0;
|
|
35 }
|
|
36 }
|
|
37
|
|
38 void rmdir_main(void)
|
|
39 {
|
|
40 char **s;
|
|
41
|
|
42 for (s=toys.optargs; *s; s++) do_rmdir(*s);
|
|
43 }
|