comparison toys/posix/mkfifo.c @ 771:4ca4134dad17

mkfifo -m is already implemented.
author Felix Janda <felix.janda@posteo.de>
date Thu, 27 Dec 2012 17:52:14 +0100
parents 786841fdb1e0
children 6cc69be43c42
comparison
equal deleted inserted replaced
770:1455c09e3f8a 771:4ca4134dad17
1 /* mkfifo.c - Create FIFOs (named pipes) 1 /* mkfifo.c - Create FIFOs (named pipes)
2 * 2 *
3 * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org> 3 * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org>
4 * 4 *
5 * See http://opengroup.org/onlinepubs/9699919799/utilities/mkfifo.html 5 * See http://opengroup.org/onlinepubs/9699919799/utilities/mkfifo.html
6 *
7 * TODO: Add -m
8 6
9 USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_BIN)) 7 USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_BIN))
10 8
11 config MKFIFO 9 config MKFIFO
12 bool "mkfifo" 10 bool "mkfifo"
28 void mkfifo_main(void) 26 void mkfifo_main(void)
29 { 27 {
30 char **s; 28 char **s;
31 29
32 TT.mode = 0666; 30 TT.mode = 0666;
33 if (toys.optflags & FLAG_m) { 31 if (toys.optflags & FLAG_m) TT.mode = string_to_mode(TT.m_string, 0);
34 TT.mode = string_to_mode(TT.m_string, 0);
35 }
36 32
37 for (s = toys.optargs; *s; s++) { 33 for (s = toys.optargs; *s; s++) {
38 if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) { 34 if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) {
39 perror_msg("cannot create fifo '%s'", *s); 35 perror_msg("cannot create fifo '%s'", *s);
40 toys.exitval = 1; 36 toys.exitval = 1;