-/**
- * db3_get_ctx - Shared with CGI buffer stuff...
- */
-struct db3_get_ctx {
- char *buffer;
- int offset;
- int size;
-};
-
-/**
- * keydb_fetchchar - Fetches a char from a file.
- */
-static int keydb_fetchchar(void *ctx, size_t count, unsigned char *c)
-{
- struct db3_get_ctx *buf = NULL;
- int i;
-
- buf = (struct db3_get_ctx *) ctx;
- for (i = 0; i < count; i++) {
- c[i] = buf->buffer[buf->offset++];
- }
-
- return (((buf->offset) == (buf->size)) ? 1 : 0);
-}
-
-/**
- * keydb_putchar - Puts a char to a file.
- */
-static int keydb_putchar(void *ctx, size_t count, unsigned char *c)
-{
- struct db3_get_ctx *buf = NULL;
- size_t newsize = 0;
- int i;
-
- buf = (struct db3_get_ctx *) ctx;
-
- for (newsize = buf->size; newsize < (buf->offset + count);
- newsize *= 2) ;
-
- if (newsize != buf->size) {
- buf->buffer = realloc(buf->buffer, newsize);
- buf->size = newsize;
- }
-
- for (i = 0; i < count; i++) {
- buf->buffer[buf->offset++] = c[i];
- }
-
- return 1;
-}
-