stop using EOF in buf to indicate end-of-file
getbuf has a return value now that indicates there was nothing to read