Only seed database for Debian install if we're using default config
[onak.git] / charfuncs.h
1 /*
2  * charfuncs.h - Routines for dealing with character streams.
3  *
4  * Jonathan McDowell <noodles@earth.li>
5  *
6  * Copyright 2002 Project Purple
7  */
8
9 #ifndef __CHARFUNCS_H__
10 #define __CHARFUNCS_H__
11
12 #include <stdlib.h>
13
14 /**
15  *      buffer_ctx - Shared with CGI buffer stuff...
16  *      @buffer: The data buffer.
17  *      @offset: Our current position in the buffer.
18  *      @size: The size of the data buffer.
19  */
20 struct buffer_ctx {
21         char *buffer;
22         size_t offset;
23         size_t size;
24 };
25
26 /**
27  *      buffer_fetchchar - Fetches a char from a buffer.
28  *      @ctx: Our buffer context structure.
29  *      @count: The number of characters to get from the buffer.
30  *      @c: Where to put the characters retrieved.
31  */
32 int buffer_fetchchar(void *ctx, size_t count, unsigned char *c);
33
34 /**
35  *      buffer_putchar - Puts a char to a buffer.
36  *      @ctx: Our buffer context structure.
37  *      @count: The number of characters to put into the buffer.
38  *      @c: The characters to add to the buffer.
39  *
40  *      Adds characters to the buffer references by the buffer context. If we
41  *      fill it then we double the size of the current buffer and then add the
42  *      rest.
43  */
44 int buffer_putchar(void *ctx, size_t count, unsigned char *c);
45
46 /**
47  *      file_fetchchar - Fetches a char from a file.
48  */
49 int file_fetchchar(void *fd, size_t count, unsigned char *c);
50
51 /**
52  *      file_putchar - Puts a char to a file.
53  */
54 int file_putchar(void *fd, size_t count, unsigned char *c);
55
56 /**
57  *      stdin_getchar - Gets a char from stdin.
58  */
59 int stdin_getchar(void *ctx, size_t count, unsigned char *c);
60
61 /**
62  *      stdout_putchar - Puts a char to stdout.
63  */
64 int stdout_putchar(void *ctx, size_t count, unsigned char *c);
65
66 #endif /* __CHARFUNCS_H__ */