1 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
2 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
3 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
4 #include <msvcrt/stdio.h>
5 #include <msvcrt/stdlib.h>
7 #include <msvcrt/errno.h>
8 #include <msvcrt/internal/file.h>
11 int setvbuf(FILE *f, char *buf, int type, size_t len)
14 if (!__validfp (f) ) {
18 if ( f->_base != NULL )
30 buf = (char *)malloc(len+1);
39 if (f->_base != NULL && f->_flag & _IOMYBUF)
43 f->_flag &= ~(_IONBF|_IOFBF|_IOLBF|_IOUNGETC);
49 f->_ptr = f->_base = buf;