154035Sbostic /*-
2*66642Spendry * Copyright (c) 1992, 1993, 1994
360694Sbostic * The Regents of the University of California. All rights reserved.
435433Sbostic *
542540Sbostic * %sccs.include.redist.c%
619845Sdist */
719845Sdist
819845Sdist #ifndef lint
960694Sbostic static char copyright[] =
10*66642Spendry "@(#) Copyright (c) 1992, 1993, 1994\n\
1160694Sbostic The Regents of the University of California. All rights reserved.\n";
1235433Sbostic #endif /* not lint */
1319845Sdist
1419845Sdist #ifndef lint
15*66642Spendry static char sccsid[] = "@(#)rmdir.c 8.3 (Berkeley) 04/02/94";
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
main(argc,argv)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
usage()5554035Sbostic usage()
5654035Sbostic {
5766562Spendry
5854035Sbostic (void)fprintf(stderr, "usage: rmdir directory ...\n");
5954035Sbostic exit(1);
6054035Sbostic }
61