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, see <https://www.gnu.org/licenses/>.
20 #ifndef __CHARFUNCS_H__
21 #define __CHARFUNCS_H__
26 * @brief Shared with CGI buffer stuff...
29 /** The data buffer. */
31 /** Our current position in the buffer. */
33 /** The size of the data buffer. */
38 * @brief Fetches a char from a buffer.
39 * @param ctx Our buffer context structure.
40 * @param count The number of characters to get from the buffer.
41 * @param c Where to put the characters retrieved.
43 int buffer_fetchchar(void *ctx, size_t count, void *c);
46 * @brief Puts a char to a buffer.
47 * @param ctx Our buffer context structure.
48 * @param count The number of characters to put into the buffer.
49 * @param 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 * @brief Fetches a char from a file.
60 int file_fetchchar(void *fd, size_t count, void *c);
63 * @brief Puts a char to a file.
65 int file_putchar(void *fd, size_t count, void *c);
68 * @brief Gets a char from stdin.
70 int stdin_getchar(void *ctx, size_t count, void *c);
73 * @brief Puts a char to stdout.
75 int stdout_putchar(void *ctx, size_t count, void *c);
77 #endif /* __CHARFUNCS_H__ */