add support for caller-provided buffers to setvbuf