1 /*- 2 * Copyright (c) 1992 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 char copyright[] = 10 "@(#) Copyright (c) 1992 The Regents of the University of California.\n\ 11 All rights reserved.\n"; 12 #endif /* not lint */ 13 14 #ifndef lint 15 static char sccsid[] = "@(#)rmdir.c 5.4 (Berkeley) 06/18/92"; 16 #endif /* not lint */ 17 18 #include <errno.h> 19 #include <unistd.h> 20 #include <stdlib.h> 21 #include <stdio.h> 22 #include <string.h> 23 24 void usage __P((void)); 25 26 int 27 main(argc, argv) 28 int argc; 29 char *argv[]; 30 { 31 int ch, errors; 32 33 while ((ch = getopt(argc, argv, "")) != EOF) 34 switch(ch) { 35 case '?': 36 default: 37 usage(); 38 } 39 argc -= optind; 40 argv += optind; 41 42 if (argc == 0) 43 usage(); 44 45 for (errors = 0; *argv; ++argv) 46 if (rmdir(*argv) < 0) { 47 (void)fprintf(stderr, 48 "rmdir: %s: %s\n", *argv, strerror(errno)); 49 errors = 1; 50 } 51 exit(errors); 52 } 53 54 void 55 usage() 56 { 57 (void)fprintf(stderr, "usage: rmdir directory ...\n"); 58 exit(1); 59 } 60