]> pd.if.org Git - pdclib/blob - fclose.c
446b8ee471efe56edea8f05b8a1c2289dd2d1f39
[pdclib] / fclose.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 fclose( FILE * stream ) { /* TODO */ };
9
10 /* PDPC code - unreviewed.
11 Read the note in fopen.c.
12 int fclose(FILE *stream)
13 {
14 #ifdef __OS2__
15     APIRET rc;
16 #endif
17
18     fflush(stream);
19 #ifdef __OS2__
20     rc = DosClose(stream->hfile);
21 #endif
22 #ifdef __MSDOS__
23     __close(stream->hfile);
24 #endif
25 #ifdef __MVS__
26     __aclose(stream->hfile);
27 #endif
28     __userFiles[stream->intFno] = NULL;
29     if (!stream->theirBuffer)
30     {
31         free(stream->intBuffer);
32     }
33     free(stream);
34 #ifdef __OS2__
35     if (rc != 0)
36     {
37         errno = rc;
38         return (EOF);
39     }
40 #endif
41     return (0);
42 }
43 */