- }
- /* Fully-buffered streams are OK. Non-buffered streams must be flushed,
- line-buffered streams only if there's a newline in the buffer.
- */
- switch ( stream->status & ( _IONBF | _IOLBF ) )
- {
- case _IONBF:
- if ( _PDCLIB_flushbuffer( stream ) == EOF )
- {
- /* We are in a pinch here. We have an error, which requires a
- return value < nmemb. On the other hand, all objects have
- been written to buffer, which means all the caller had to
- do was removing the error cause, and re-flush the stream...
- Catch 22. We'll return a value one short, to indicate the
- error, and can't really do anything about the inconsistency.
- */
- return nmemb_i - 1;
- }
- break;
- case _IOLBF:
- {
- size_t bufidx = stream->bufidx;
- stream->bufidx = offset;