1 #include <stdio.h> 2 #include <unistd.h> 3 #include <string.h> 4 #include <errno.h> 5 6 static int usage() 7 { 8 fprintf(stderr,"rmdir <directory>\n"); 9 return -1; 10 } 11 12 int rmdir_main(int argc, char *argv[]) 13 { 14 int symbolic = 0; 15 int ret; 16 if(argc < 2) return usage(); 17 18 while(argc > 1) { 19 argc--; 20 argv++; 21 ret = rmdir(argv[0]); 22 if(ret < 0) { 23 fprintf(stderr, "rmdir failed for %s, %s\n", argv[0], strerror(errno)); 24 return ret; 25 } 26 } 27 28 return 0; 29 } 30