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