prettyness police
[unix-history] / usr / src / bin / rmdir / rmdir.c
CommitLineData
19875fc6 1/*-
ce2605ad
KB
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
e7e5aa72 4 *
27c71911 5 * %sccs.include.redist.c%
bcf1365c
DF
6 */
7
8#ifndef lint
ce2605ad
KB
9static char copyright[] =
10"@(#) Copyright (c) 1992, 1993\n\
11 The Regents of the University of California. All rights reserved.\n";
e7e5aa72 12#endif /* not lint */
bcf1365c
DF
13
14#ifndef lint
706c0358 15static char sccsid[] = "@(#)rmdir.c 8.2 (Berkeley) %G%";
e7e5aa72 16#endif /* not lint */
bcf1365c 17
25b4510c 18#include <err.h>
19875fc6 19#include <errno.h>
ff487e30 20#include <stdio.h>
25b4510c 21#include <stdlib.h>
19875fc6 22#include <string.h>
25b4510c 23#include <unistd.h>
19875fc6
KB
24
25void usage __P((void));
ff487e30 26
19875fc6 27int
e7e5aa72 28main(argc, argv)
a645d56b 29 int argc;
19875fc6 30 char *argv[];
ff487e30 31{
19875fc6
KB
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;
ff487e30 42
19875fc6
KB
43 if (argc == 0)
44 usage();
45
46 for (errors = 0; *argv; ++argv)
e7e5aa72 47 if (rmdir(*argv) < 0) {
25b4510c 48 warn("%s", *argv);
e7e5aa72 49 errors = 1;
a645d56b 50 }
e7e5aa72 51 exit(errors);
ff487e30 52}
19875fc6
KB
53
54void
55usage()
56{
706c0358 57
19875fc6
KB
58 (void)fprintf(stderr, "usage: rmdir directory ...\n");
59 exit(1);
60}