530
|
1 /* vi: set sw=4 ts=4:
|
|
2 *
|
|
3 * mkfifo.c - Create FIFOs (named pipes)
|
|
4 *
|
|
5 * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org>
|
|
6 *
|
|
7 * See http://pubs.opengroup.org/onlinepubs/009695399/utilities/mkfifo.html
|
|
8 *
|
|
9 * TODO: Add -m
|
|
10
|
|
11 USE_MKFIFO(NEWTOY(mkfifo, "<1", TOYFLAG_BIN))
|
|
12
|
|
13 config MKFIFO
|
|
14 bool "mkfifo"
|
|
15 default y
|
|
16 help
|
|
17 usage: mkfifo [fifo_name...]
|
|
18 Create FIFOs (named pipes).
|
|
19
|
|
20 */
|
|
21
|
|
22 #include "toys.h"
|
|
23
|
|
24 void mkfifo_main(void)
|
|
25 {
|
|
26 char **s;
|
|
27 mode_t mode = 0666;
|
|
28 for (s = toys.optargs; *s; s++) {
|
|
29 if (mknod(*s, S_IFIFO | mode, 0) < 0) {
|
|
30 fprintf(stderr, "mkfifo: cannot create fifo `%s': %s\n", *s, strerror(errno));
|
|
31 toys.exitval = 1;
|
|
32 }
|
|
33 }
|
|
34 }
|