Rev 1497 | Rev 1518 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1497 | Rev 1508 | ||
|---|---|---|---|
| Line 115... | Line 115... | ||
| 115 | stream.w = write_stdout; |
115 | stream.w = write_stdout; |
| 116 | stream.param = 0; |
116 | stream.param = 0; |
| 117 | return stream; |
117 | return stream; |
| 118 | } |
118 | } |
| 119 | 119 | ||
| - | 120 | static ssize_t write_null(void *param, const void *buf, size_t count) |
|
| - | 121 | { |
|
| - | 122 | return count; |
|
| - | 123 | } |
|
| - | 124 | ||
| - | 125 | ||
| 120 | fd_t open(const char *fname, int flags) |
126 | fd_t open(const char *fname, int flags) |
| 121 | { |
127 | { |
| 122 | int c = 0; |
128 | int c = 0; |
| 123 | 129 | ||
| 124 | while (((streams[c].w) || (streams[c].r)) && (c < FDS)) |
130 | while (((streams[c].w) || (streams[c].r)) && (c < FDS)) |
| Line 140... | Line 146... | ||
| 140 | 146 | ||
| 141 | if (!strcmp(fname, "stderr")) { |
147 | if (!strcmp(fname, "stderr")) { |
| 142 | streams[c].w = write_stderr; |
148 | streams[c].w = write_stderr; |
| 143 | return c; |
149 | return c; |
| 144 | } |
150 | } |
| - | 151 | if (!strcmp(fname, "null")) { |
|
| - | 152 | streams[c].w = write_null; |
|
| - | 153 | return c; |
|
| - | 154 | } |
|
| 145 | } |
155 | } |
| 146 | 156 | ||
| 147 | 157 | ||
| 148 | ssize_t write(int fd, const void *buf, size_t count) |
158 | ssize_t write(int fd, const void *buf, size_t count) |
| 149 | { |
159 | { |