static void
doapr_outch(
    char **buffer,
    size_t *currlen,
    size_t *maxlen,
    int c)
{
    if (*buffer == NULL) {
	if (*maxlen == 0)
	    *maxlen = 1024;
	*buffer = Malloc(*maxlen);
    }
    while (*currlen >= *maxlen) {
	*maxlen += 1024;
	*buffer = Realloc(*buffer, *maxlen);
    }
    /* What to do if *buffer is NULL? */
    assert(*buffer != NULL);

    (*buffer)[(*currlen)++] = (char)c;
    return;
}