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