mkfifo.c (547B)
1 /* See LICENSE file for copyright and license details. */ 2 #include <sys/stat.h> 3 4 #include <stdlib.h> 5 6 #include "util.h" 7 8 static void 9 usage(void) 10 { 11 eprintf("usage: %s [-m mode] name ...\n", argv0); 12 } 13 14 int 15 main(int argc, char *argv[]) 16 { 17 mode_t mode = 0666; 18 int ret = 0; 19 20 ARGBEGIN { 21 case 'm': 22 mode = parsemode(EARGF(usage()), mode, umask(0)); 23 break; 24 default: 25 usage(); 26 } ARGEND 27 28 if (!argc) 29 usage(); 30 31 for (; *argv; argc--, argv++) { 32 if (mkfifo(*argv, mode) < 0) { 33 weprintf("mkfifo %s:", *argv); 34 ret = 1; 35 } 36 } 37 38 return ret; 39 }