3 Bopen, Binit, Binits, Brdline, Brdstr, Bgetc, Bgetd, Bungetc, Bread, Bseek, Boffset, Bfildes, Blinelen, Bputc, Bprint, Bvprint, Bwrite, Bflush, Bterm, Bbuffered \- buffered input/output
10 Biobuf* Bopen(char *file, int mode)
13 int Binit(Biobuf *bp, int fd, int mode)
19 int Bprint(Biobuf *bp, char *format, ...)
22 int Bvprint(Biobuf *bp, char *format, va_list arglist);
25 void* Brdline(Biobuf *bp, int delim)
28 char* Brdstr(Biobuf *bp, int delim, int nulldelim)
31 int Blinelen(Biobuf *bp)
34 off_t Boffset(Biobuf *bp)
37 int Bfildes(Biobuf *bp)
43 long Bgetrune(Biobufhdr *bp)
46 int Bgetd(Biobuf *bp, double *d)
49 int Bungetc(Biobuf *bp)
52 int Bungetrune(Biobufhdr *bp)
55 off_t Bseek(Biobuf *bp, off_t n, int type)
58 int Bputc(Biobuf *bp, int c)
61 int Bputrune(Biobufhdr *bp, long c)
64 long Bread(Biobuf *bp, void *addr, long nbytes)
67 long Bwrite(Biobuf *bp, void *addr, long nbytes)
70 int Bflush(Biobuf *bp)
73 int Bbuffered(Biobuf *bp)
76 These routines implement fast buffered I/O.
77 I/O on different file descriptors is independent.
92 with the open file descriptor passed in
96 of types pointer to Biobuf and pointer to Biobuf
97 can be used interchangeably in the following routines.
103 should be called before any of the
104 other routines on that buffer.
106 returns the integer file descriptor of the associated open file.
109 flushes the buffer for
111 If the buffer was allocated by
115 and the file is closed.
118 reads a string from the file associated with
120 up to and including the first
123 The delimiter character at the end of the line is
126 returns a pointer to the start of the line or
128 on end-of-file or read error.
130 returns the length (including the delimiter)
131 of the most recent string returned by
136 .IR malloc (3)-allocated
137 buffer containing the next line of input delimited by
139 terminated by a NUL (0) byte.
142 which returns when its buffer is full even if no delimiter has been found,
144 will return an arbitrarily long line in a single call.
147 is set, the terminal delimiter will be overwritten with a NUL.
148 After a successful call to
152 will be the length of the returned buffer, excluding the NUL.
155 returns the next byte from
160 may be called immediately after
162 to allow the same byte to be reread.
167 to read the bytes of the next
169 sequence in the input stream and returns the value of the rune
170 represented by the sequence.
171 It returns a negative value
174 may be called immediately after
178 sequence to be reread as either bytes or a rune.
182 may back up a maximum of five bytes.
190 to read the formatted
191 floating-point number in the input stream,
192 skipping initial blanks and tabs.
193 The value is stored in
201 into memory starting at
203 The number of bytes read is returned on success
204 and a negative value is returned if a read error occurred.
211 It returns the new file offset.
213 returns the file offset of the next character to be processed.
216 outputs the low order 8 bits of
222 to occur and there is an error,
223 a negative value is returned.
224 Otherwise, a zero is returned.
229 to output the low order
236 on the output stream.
239 is a buffered interface to
243 to occur and there is an error,
247 Otherwise, the number of bytes output is returned.
249 does the same except it takes as argument a
251 parameter, so it can be called within a variadic function.
262 to occur and there is an error,
263 a negative value is returned.
264 Otherwise, the number of bytes written is returned.
267 causes any buffered output associated with
274 exit for every buffer still open
278 returns the number of bytes in the buffer.
279 When reading, this is the number of bytes still available from the last
280 read on the file; when writing, it is the number of bytes ready to be
285 for diagnostic messages about internal errors,
286 as well as for the implementation of
292 for the implementation of
303 routines that return integers yield
307 is not the descriptor of an open file.
309 returns zero if the file cannot be opened in the given mode.
313 library originally appeared in Plan 9.
314 This is a port of the Plan 9 bio library.
317 returns an error on strings longer than the buffer associated
319 and also if the end-of-file is encountered
322 will tell how many characters are available
324 In the case of a true end-of-file,
327 At the cost of allocating a buffer,
329 sidesteps these issues.
333 may be overwritten by calls to any other