1 /* _PDCLIB_prepwrite( struct _PDCLIB_file_t * )
3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
9 int _PDCLIB_prepwrite( struct _PDCLIB_file_t * stream )
11 if ( ( stream->bufidx < stream->bufend ) || ( stream->ungetidx > 0 ) ||
12 ( stream->status & ( _PDCLIB_FREAD | _PDCLIB_ERRORFLAG | _PDCLIB_WIDESTREAM | _PDCLIB_EOFFLAG ) ) ||
13 ! ( stream->status & ( _PDCLIB_FWRITE | _PDCLIB_FAPPEND | _PDCLIB_FRW ) ) )
15 /* Function called on illegal (e.g. input) stream.
16 See the comments on implementation-defined errno values in
19 _PDCLIB_errno = _PDCLIB_ERROR;
20 stream->status |= _PDCLIB_ERRORFLAG;
23 stream->status |= _PDCLIB_FWRITE | _PDCLIB_BYTESTREAM;
28 #include "_PDCLIB_test.h"
32 /* Testing covered by ftell.c */