| 1 | .TH subfd 3 |
| 2 | .SH NAME |
| 3 | subfd \- standard input, output, error for substdio |
| 4 | .SH SYNTAX |
| 5 | .B #include <subfd.h> |
| 6 | |
| 7 | substdio *\fBsubfdin\fP; |
| 8 | .br |
| 9 | substdio *\fBsubfdout\fP; |
| 10 | .br |
| 11 | substdio *\fBsubfderr\fP; |
| 12 | |
| 13 | int \fBsubfd_read\fP(\fIfd\fR,\fIbuf\fR,\fIlen\fR); |
| 14 | |
| 15 | substdio *\fBsubfdinsmall\fP; |
| 16 | .br |
| 17 | substdio *\fBsubfdoutsmall\fP; |
| 18 | |
| 19 | int \fBsubfd_readsmall\fP(\fIfd\fR,\fIbuf\fR,\fIlen\fR); |
| 20 | |
| 21 | int \fIfd\fR; |
| 22 | .br |
| 23 | char *\fIbuf\fR; |
| 24 | .br |
| 25 | int \fIlen\fR; |
| 26 | .SH DESCRIPTION |
| 27 | .B subfderr |
| 28 | writes data to descriptor 2. |
| 29 | |
| 30 | .B subfdout |
| 31 | writes data to descriptor 1. |
| 32 | |
| 33 | .B subfdin |
| 34 | reads data from descriptor 0. |
| 35 | It coordinates with |
| 36 | .BR subfdout : |
| 37 | it flushes |
| 38 | .B subfdout |
| 39 | before refilling its buffer. |
| 40 | This eliminates the need for |
| 41 | .B subfdout |
| 42 | flushing in most programs. |
| 43 | To set up the same flushing mechanism for another input descriptor, |
| 44 | use |
| 45 | .B subfd_read |
| 46 | in place of |
| 47 | .BR read . |
| 48 | |
| 49 | .BR subfdoutsmall , |
| 50 | .BR subfd_readsmall , |
| 51 | and |
| 52 | .B subfdinsmall |
| 53 | behave the same way as |
| 54 | .BR subfdout , |
| 55 | .BR subfd_read , |
| 56 | and |
| 57 | .BR subfdin , |
| 58 | except that they use small (256-byte) buffers. |
| 59 | This is appropriate for programs that read data in small chunks. |
| 60 | .SH "SEE ALSO" |
| 61 | substdio(3) |