Mercurial > hg > toybox
comparison toys/posix/mkfifo.c @ 694:786841fdb1e0
Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
The actual code should be the same afterward, this is just cosmetic refactoring.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 13 Nov 2012 17:14:08 -0600 |
parents | 7e846e281e38 |
children | 4ca4134dad17 |
comparison
equal
deleted
inserted
replaced
693:4a5a250e0633 | 694:786841fdb1e0 |
---|---|
1 /* vi: set sw=4 ts=4: | 1 /* mkfifo.c - Create FIFOs (named pipes) |
2 * | |
3 * mkfifo.c - Create FIFOs (named pipes) | |
4 * | 2 * |
5 * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org> | 3 * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org> |
6 * | 4 * |
7 * See http://opengroup.org/onlinepubs/9699919799/utilities/mkfifo.html | 5 * See http://opengroup.org/onlinepubs/9699919799/utilities/mkfifo.html |
8 * | 6 * |
9 * TODO: Add -m | 7 * TODO: Add -m |
10 | 8 |
11 USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_BIN)) | 9 USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_BIN)) |
12 | 10 |
13 config MKFIFO | 11 config MKFIFO |
14 bool "mkfifo" | 12 bool "mkfifo" |
15 default y | 13 default y |
16 help | 14 help |
17 usage: mkfifo [fifo_name...] | 15 usage: mkfifo [fifo_name...] |
18 | 16 |
19 Create FIFOs (named pipes). | 17 Create FIFOs (named pipes). |
20 */ | 18 */ |
21 | 19 |
22 #define FOR_mkfifo | 20 #define FOR_mkfifo |
23 #include "toys.h" | 21 #include "toys.h" |
24 | 22 |
25 GLOBALS( | 23 GLOBALS( |
26 char *m_string; | 24 char *m_string; |
27 mode_t mode; | 25 mode_t mode; |
28 ) | 26 ) |
29 | 27 |
30 void mkfifo_main(void) | 28 void mkfifo_main(void) |
31 { | 29 { |
32 char **s; | 30 char **s; |
33 | 31 |
34 TT.mode = 0666; | 32 TT.mode = 0666; |
35 if (toys.optflags & FLAG_m) { | 33 if (toys.optflags & FLAG_m) { |
36 TT.mode = string_to_mode(TT.m_string, 0); | 34 TT.mode = string_to_mode(TT.m_string, 0); |
37 } | 35 } |
38 | 36 |
39 for (s = toys.optargs; *s; s++) { | 37 for (s = toys.optargs; *s; s++) { |
40 if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) { | 38 if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) { |
41 perror_msg("cannot create fifo '%s'", *s); | 39 perror_msg("cannot create fifo '%s'", *s); |
42 toys.exitval = 1; | 40 toys.exitval = 1; |
43 } | 41 } |
44 } | 42 } |
45 } | 43 } |