1 /* mkfifo.c - Create FIFOs (named pipes) 2 * 3 * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org> 4 * 5 * See http://opengroup.org/onlinepubs/9699919799/utilities/mkfifo.html 6 7 USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_USR|TOYFLAG_BIN)) 8 9 config MKFIFO 10 bool "mkfifo" 11 default y 12 help 13 usage: mkfifo [fifo_name...] 14 15 Create FIFOs (named pipes). 16 */ 17 18 #define FOR_mkfifo 19 #include "toys.h" 20 GLOBALS(char * m_string;mode_t mode;)21GLOBALS( 22 char *m_string; 23 mode_t mode; 24 ) 25 26 void mkfifo_main(void) 27 { 28 char **s; 29 30 TT.mode = 0666; 31 if (toys.optflags & FLAG_m) TT.mode = string_to_mode(TT.m_string, 0); 32 33 for (s = toys.optargs; *s; s++) 34 if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) perror_msg("%s", *s); 35 } 36