comparison toys/posix/rmdir.c @ 782:3d7526f6115b

Use basename() where appropriate.
author Rob Landley <rob@landley.net>
date Sat, 05 Jan 2013 00:44:24 -0600
parents 786841fdb1e0
children fc1bb49e58a9
comparison
equal deleted inserted replaced
781:b300eb824c70 782:3d7526f6115b
18 18
19 #include "toys.h" 19 #include "toys.h"
20 20
21 static void do_rmdir(char *name) 21 static void do_rmdir(char *name)
22 { 22 {
23 char *temp;
24
23 for (;;) { 25 for (;;) {
24 char *temp;
25
26 if (rmdir(name)) { 26 if (rmdir(name)) {
27 perror_msg("%s",name); 27 perror_msg("%s",name);
28 return; 28 return;
29 } 29 }
30
31 // Each -p cycle back up one slash, ignoring trailing and repeated /.
32
30 if (!toys.optflags) return; 33 if (!toys.optflags) return;
31 if (!(temp=strrchr(name,'/'))) return; 34 do {
32 *temp=0; 35 if (!(temp = strrchr(name, '/'))) return;
36 *temp = 0;
37 } while (!temp[1]);
33 } 38 }
34 } 39 }
35 40
36 void rmdir_main(void) 41 void rmdir_main(void)
37 { 42 {