headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / libroot / posix / stdio / __freading.cpp
blobece7bc922c200ff96f128b50f95916455e8b7919
1 /*
2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
6 #include <libio.h>
7 #include <stdio_ext.h>
10 int
11 __freading(FILE* stream)
13 // Return true, if writing is not allowed or the last operation was a read.
14 return (stream->_flags & _IO_NO_WRITES) != 0
15 || ((stream->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
16 && stream->_IO_read_base != NULL);