154035Sbostic /*- 2*60694Sbostic * Copyright (c) 1992, 1993 3*60694Sbostic * The Regents of the University of California. All rights reserved. 435433Sbostic * 542540Sbostic * %sccs.include.redist.c% 619845Sdist */ 719845Sdist 819845Sdist #ifndef lint 9*60694Sbostic static char copyright[] = 10*60694Sbostic "@(#) Copyright (c) 1992, 1993\n\ 11*60694Sbostic The Regents of the University of California. All rights reserved.\n"; 1235433Sbostic #endif /* not lint */ 1319845Sdist 1419845Sdist #ifndef lint 15*60694Sbostic static char sccsid[] = "@(#)rmdir.c 8.1 (Berkeley) 05/31/93"; 1635433Sbostic #endif /* not lint */ 1719845Sdist 1859516Sbostic #include <err.h> 1954035Sbostic #include <errno.h> 2059516Sbostic #include <stdio.h> 2154035Sbostic #include <stdlib.h> 2254035Sbostic #include <string.h> 2359516Sbostic #include <unistd.h> 241085Sbill 2554035Sbostic void usage __P((void)); 2654035Sbostic 2754035Sbostic int 2835433Sbostic main(argc, argv) 299849Ssam int argc; 3054035Sbostic char *argv[]; 311085Sbill { 3254035Sbostic int ch, errors; 331085Sbill 3454035Sbostic while ((ch = getopt(argc, argv, "")) != EOF) 3554035Sbostic switch(ch) { 3654035Sbostic case '?': 3754035Sbostic default: 3854035Sbostic usage(); 3954035Sbostic } 4054035Sbostic argc -= optind; 4154035Sbostic argv += optind; 4254035Sbostic 4354035Sbostic if (argc == 0) 4454035Sbostic usage(); 4554035Sbostic 4654035Sbostic for (errors = 0; *argv; ++argv) 4735433Sbostic if (rmdir(*argv) < 0) { 4859516Sbostic warn("%s", *argv); 4935433Sbostic errors = 1; 509849Ssam } 5135433Sbostic exit(errors); 521085Sbill } 5354035Sbostic 5454035Sbostic void 5554035Sbostic usage() 5654035Sbostic { 5754035Sbostic (void)fprintf(stderr, "usage: rmdir directory ...\n"); 5854035Sbostic exit(1); 5954035Sbostic } 60