]> pd.if.org Git - pdclib/blob - fflush.c
66e97a587f7c88a0453025aae336c2eefb9c6c58
[pdclib] / fflush.c
1 // ----------------------------------------------------------------------------
2 // $Id$
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
7
8 int fflush( FILE * stream ) { /* TODO */ };
9
10 /* PDPC code - unreviewed
11 Read the note in fopen.c.
12 {
13 #ifdef __OS2__
14     APIRET rc;
15     ULONG actualWritten;
16 #endif
17 #ifdef __MSDOS__
18     int errind;
19     size_t actualWritten;
20 #endif
21
22     if ((stream->upto != stream->fbuf) && (stream->mode == __WRITE_MODE))
23     {
24 #ifdef __OS2__
25         rc = DosWrite(stream->hfile,
26                      (VOID *)stream->fbuf,
27                      (size_t)(stream->upto - stream->fbuf),
28                      &actualWritten);
29         if (rc != 0)
30         {
31             stream->errorInd = 1;
32             errno = rc;
33             return (EOF);
34         }
35 #endif
36 #ifdef __MSDOS__
37         actualWritten = __write(stream->hfile,
38                                 stream->fbuf,
39                                 (size_t)(stream->upto - stream->fbuf),
40                                 &errind);
41         if (errind)
42         {
43             stream->errorInd = 1;
44             errno = actualWritten;
45             return (EOF);
46         }
47 #endif
48 #ifndef __MVS__
49         stream->bufStartR += actualWritten;
50         stream->upto = stream->fbuf;
51 #endif
52     }
53     return (0);
54 }
55 */