3 /* setvbuf( FILE *, char *, int, size_t )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
14 int setvbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf, int mode, size_t size )
16 /* TODO: Only allowed on a "virgin" stream; add check. */
17 if ( ( stream->status & ( _IOFBF | _IOLBF | _IONBF ) ) /* Only allowed on "virgin" stream */
18 || ( ( mode != _IOFBF ) && ( mode != _IOLBF ) && ( mode != _IONBF ) ) /* invalid mode */
19 || ( ( buf == NULL ) && ( ( buf = malloc( size ) ) == NULL ) ) /* no memory available */
24 stream->status |= mode;
26 stream->bufsize = size;
33 #include <_PDCLIB_test.h>
37 TESTCASE( NO_TESTDRIVER );