1*54035Sbostic /*- 2*54035Sbostic * Copyright (c) 1992 The Regents of the University of California. 335433Sbostic * All rights reserved. 435433Sbostic * 542540Sbostic * %sccs.include.redist.c% 619845Sdist */ 719845Sdist 819845Sdist #ifndef lint 919845Sdist char copyright[] = 10*54035Sbostic "@(#) Copyright (c) 1992 The Regents of the University of California.\n\ 1119845Sdist All rights reserved.\n"; 1235433Sbostic #endif /* not lint */ 1319845Sdist 1419845Sdist #ifndef lint 15*54035Sbostic static char sccsid[] = "@(#)rmdir.c 5.4 (Berkeley) 06/18/92"; 1635433Sbostic #endif /* not lint */ 1719845Sdist 18*54035Sbostic #include <errno.h> 19*54035Sbostic #include <unistd.h> 20*54035Sbostic #include <stdlib.h> 211085Sbill #include <stdio.h> 22*54035Sbostic #include <string.h> 231085Sbill 24*54035Sbostic void usage __P((void)); 25*54035Sbostic 26*54035Sbostic int 2735433Sbostic main(argc, argv) 289849Ssam int argc; 29*54035Sbostic char *argv[]; 301085Sbill { 31*54035Sbostic int ch, errors; 321085Sbill 33*54035Sbostic while ((ch = getopt(argc, argv, "")) != EOF) 34*54035Sbostic switch(ch) { 35*54035Sbostic case '?': 36*54035Sbostic default: 37*54035Sbostic usage(); 38*54035Sbostic } 39*54035Sbostic argc -= optind; 40*54035Sbostic argv += optind; 41*54035Sbostic 42*54035Sbostic if (argc == 0) 43*54035Sbostic usage(); 44*54035Sbostic 45*54035Sbostic for (errors = 0; *argv; ++argv) 4635433Sbostic if (rmdir(*argv) < 0) { 47*54035Sbostic (void)fprintf(stderr, 48*54035Sbostic "rmdir: %s: %s\n", *argv, strerror(errno)); 4935433Sbostic errors = 1; 509849Ssam } 5135433Sbostic exit(errors); 521085Sbill } 53*54035Sbostic 54*54035Sbostic void 55*54035Sbostic usage() 56*54035Sbostic { 57*54035Sbostic (void)fprintf(stderr, "usage: rmdir directory ...\n"); 58*54035Sbostic exit(1); 59*54035Sbostic } 60