1 /*
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8 #ifndef lint
9 static char copyright[] =
10 "@(#) Copyright (c) 1990, 1993\n\
11 The Regents of the University of California. All rights reserved.\n";
12 #endif /* not lint */
13
14 #ifndef lint
15 static char sccsid[] = "@(#)mkfifo.c 8.2 (Berkeley) 01/05/94";
16 #endif /* not lint */
17
18 #include <sys/types.h>
19 #include <sys/stat.h>
20
21 #include <errno.h>
22 #include <stdio.h>
23 #include <string.h>
24
25 int
main(argc,argv)26 main(argc, argv)
27 int argc;
28 char *argv[];
29 {
30 extern int optind;
31 int ch, exitval;
32
33 while ((ch = getopt(argc, argv, "")) != EOF)
34 switch(ch) {
35 case '?':
36 default:
37 usage();
38 }
39 argc -= optind;
40 argv += optind;
41 if (argv[0] == NULL)
42 usage();
43
44 for (exitval = 0; *argv != NULL; ++argv)
45 if (mkfifo(*argv, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
46 warn("%s", *argv);
47 exitval = 1;
48 }
49 exit(exitval);
50 }
51
usage()52 usage()
53 {
54 (void)fprintf(stderr, "usage: mkfifo fifoname ...\n");
55 exit(1);
56 }
57