2 * charfuncs.h - Routines for dealing with character streams.
4 * Copyright 2002 Jonathan McDowell <noodles@earth.li>
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __CHARFUNCS_H__
21 #define __CHARFUNCS_H__
26 * buffer_ctx - Shared with CGI buffer stuff...
27 * @buffer: The data buffer.
28 * @offset: Our current position in the buffer.
29 * @size: The size of the data buffer.
38 * buffer_fetchchar - Fetches a char from a buffer.
39 * @ctx: Our buffer context structure.
40 * @count: The number of characters to get from the buffer.
41 * @c: Where to put the characters retrieved.
43 int buffer_fetchchar(void *ctx, size_t count, void *c);
46 * buffer_putchar - Puts a char to a buffer.
47 * @ctx: Our buffer context structure.
48 * @count: The number of characters to put into the buffer.
49 * @c: The characters to add to the buffer.
51 * Adds characters to the buffer references by the buffer context. If we
52 * fill it then we double the size of the current buffer and then add the
55 int buffer_putchar(void *ctx, size_t count, void *c);
58 * file_fetchchar - Fetches a char from a file.
60 int file_fetchchar(void *fd, size_t count, void *c);
63 * file_putchar - Puts a char to a file.
65 int file_putchar(void *fd, size_t count, void *c);
68 * stdin_getchar - Gets a char from stdin.
70 int stdin_getchar(void *ctx, size_t count, void *c);
73 * stdout_putchar - Puts a char to stdout.
75 int stdout_putchar(void *ctx, size_t count, void *c);
77 #endif /* __CHARFUNCS_H__ */