2011-05-25 06:00:15 -04:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/stat.h>
|
2014-11-13 13:54:28 -05:00
|
|
|
#include <unistd.h>
|
2014-11-13 12:29:30 -05:00
|
|
|
|
2011-05-25 06:00:15 -04:00
|
|
|
#include "util.h"
|
|
|
|
|
2013-06-14 14:20:47 -04:00
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
2013-11-30 15:56:34 -05:00
|
|
|
eprintf("usage: %s [-m mode] name...\n", argv0);
|
2013-06-14 14:20:47 -04:00
|
|
|
}
|
|
|
|
|
2011-05-25 06:00:15 -04:00
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2013-11-30 15:56:34 -05:00
|
|
|
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP |
|
|
|
|
S_IWGRP | S_IROTH | S_IWOTH;
|
|
|
|
|
2013-06-14 14:20:47 -04:00
|
|
|
ARGBEGIN {
|
2013-11-30 15:56:34 -05:00
|
|
|
case 'm':
|
|
|
|
mode = estrtol(EARGF(usage()), 8);
|
|
|
|
break;
|
2013-06-14 14:20:47 -04:00
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
} ARGEND;
|
2013-08-31 18:04:49 -04:00
|
|
|
|
|
|
|
if (argc < 1)
|
|
|
|
usage();
|
|
|
|
|
2014-11-13 12:29:30 -05:00
|
|
|
for (; argc > 0; argc--, argv++)
|
2014-11-19 14:59:37 -05:00
|
|
|
if (mkfifo(argv[0], mode) < 0)
|
2013-06-14 14:20:47 -04:00
|
|
|
eprintf("mkfifo %s:", argv[0]);
|
2014-10-02 18:46:04 -04:00
|
|
|
return 0;
|
2011-05-25 06:00:15 -04:00
|
|
|
}
|