1/* 2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6#include <libio.h> 7#include <stdio_ext.h> 8 9 10int 11__freading(FILE* stream) 12{ 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); 17} 18