]> pd.if.org Git - pdclib.old/blob - functions/stdio/ferror.c
394dcda2bc7dd07dee9cad93b61dfd95ec50ddd1
[pdclib.old] / functions / stdio / ferror.c
1 /* $Id$ */
2
3 /* ferror( FILE * )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <stdio.h>
10
11 #ifndef REGTEST
12
13 int ferror_unlocked( struct _PDCLIB_file_t * stream )
14 {
15     return stream->status & _PDCLIB_ERRORFLAG;
16 }
17
18 int ferror( struct _PDCLIB_file_t * stream )
19 {
20     flockfile( stream );
21     int error = ferror_unlocked( stream );
22     funlockfile( stream );
23     return error;
24 }
25
26 #endif
27
28 #ifdef TEST
29 #include <_PDCLIB_test.h>
30
31 int main( void )
32 {
33     /* Testing covered by clearerr(). */
34     return TEST_RESULTS;
35 }
36
37 #endif
38