2011-05-25 10:00:15 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <sys/stat.h>
|
2015-02-14 20:02:41 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
2014-11-13 17:29:30 +00:00
|
|
|
|
2011-05-25 10:00:15 +00:00
|
|
|
#include "util.h"
|
|
|
|
|
2013-06-14 18:20:47 +00:00
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
2015-03-02 16:25:29 +00:00
|
|
|
eprintf("usage: %s [-m mode] name ...\n", argv0);
|
2013-06-14 18:20:47 +00:00
|
|
|
}
|
|
|
|
|
2011-05-25 10:00:15 +00:00
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2019-06-13 20:45:37 +00:00
|
|
|
mode_t mode = 0666;
|
|
|
|
int ret = 0;
|
2013-11-30 20:56:34 +00:00
|
|
|
|
2013-06-14 18:20:47 +00:00
|
|
|
ARGBEGIN {
|
2013-11-30 20:56:34 +00:00
|
|
|
case 'm':
|
2019-06-13 20:45:37 +00:00
|
|
|
mode = parsemode(EARGF(usage()), mode, umask(0));
|
2013-11-30 20:56:34 +00:00
|
|
|
break;
|
2013-06-14 18:20:47 +00:00
|
|
|
default:
|
|
|
|
usage();
|
2015-11-01 10:16:49 +00:00
|
|
|
} ARGEND
|
2013-08-31 22:04:49 +00:00
|
|
|
|
2015-03-02 16:25:29 +00:00
|
|
|
if (!argc)
|
2013-08-31 22:04:49 +00:00
|
|
|
usage();
|
|
|
|
|
2015-03-02 16:25:29 +00:00
|
|
|
for (; *argv; argc--, argv++) {
|
2019-06-13 20:45:37 +00:00
|
|
|
if (mkfifo(*argv, mode) < 0) {
|
2015-03-02 16:25:29 +00:00
|
|
|
weprintf("mkfifo %s:", *argv);
|
2014-11-22 11:18:05 +00:00
|
|
|
ret = 1;
|
2015-01-28 19:55:50 +00:00
|
|
|
}
|
2014-11-22 11:18:05 +00:00
|
|
|
}
|
2015-03-02 16:25:29 +00:00
|
|
|
|
2014-11-22 11:18:05 +00:00
|
|
|
return ret;
|
2011-05-25 10:00:15 +00:00
|
|
|
}
|