3 * @brief Routines for dealing with character streams.
5 * Copyright 2002 Jonathan McDowell <noodles@earth.li>
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 51
18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef __CHARFUNCS_H__
22 #define __CHARFUNCS_H__
27 * @brief Shared with CGI buffer stuff...
30 /** The data buffer. */
32 /** Our current position in the buffer. */
34 /** The size of the data buffer. */
39 * @brief Fetches a char from a buffer.
40 * @param ctx Our buffer context structure.
41 * @param count The number of characters to get from the buffer.
42 * @param c Where to put the characters retrieved.
44 int buffer_fetchchar(void *ctx, size_t count, void *c);
47 * @brief Puts a char to a buffer.
48 * @param ctx Our buffer context structure.
49 * @param count The number of characters to put into the buffer.
50 * @param c The characters to add to the buffer.
52 * Adds characters to the buffer references by the buffer context. If we
53 * fill it then we double the size of the current buffer and then add the
56 int buffer_putchar(void *ctx, size_t count, void *c);
59 * @brief Fetches a char from a file.
61 int file_fetchchar(void *fd, size_t count, void *c);
64 * @brief Puts a char to a file.
66 int file_putchar(void *fd, size_t count, void *c);
69 * @brief Gets a char from stdin.
71 int stdin_getchar(void *ctx, size_t count, void *c);
74 * @brief Puts a char to stdout.
76 int stdout_putchar(void *ctx, size_t count, void *c);
78 #endif /* __CHARFUNCS_H__ */