154035Sbostic /*- 254035Sbostic * 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[] = 1054035Sbostic "@(#) 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*59516Sbostic static char sccsid[] = "@(#)rmdir.c 5.5 (Berkeley) 04/29/93"; 1635433Sbostic #endif /* not lint */ 1719845Sdist 18*59516Sbostic #include <err.h> 1954035Sbostic #include <errno.h> 20*59516Sbostic #include <stdio.h> 2154035Sbostic #include <stdlib.h> 2254035Sbostic #include <string.h> 23*59516Sbostic #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) { 48*59516Sbostic 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