]> pd.if.org Git - pdclib/blob - functions/stdio/fflush.c
Added some functions.
[pdclib] / functions / stdio / fflush.c
1 /* $Id$ */
2
3 /* fflush( 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 #include <_PDCLIB_glue.h>
11
12 #ifndef REGTEST
13
14 int fflush( struct _PDCLIB_file_t * stream )
15 {
16     /* FIXME: This is ad-hoc. */
17     if ( fwrite( stream->buffer, stream->bufidx, 1, stream ) == stream->bufidx )
18     {
19         stream->bufidx = 0;
20         return 0;
21     }
22     else
23     {
24         stream->status |= _PDCLIB_ERRORFLAG;
25         return EOF;
26     }
27 }
28
29 #endif
30
31 #ifdef TEST
32 #include <_PDCLIB_test.h>
33
34 int main( void )
35 {
36     TESTCASE( NO_TESTDRIVER );
37     return TEST_RESULTS;
38 }
39
40 #endif
41