X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffclose.c;h=f672fb0abb9cadd16ddc32f6b5a2020400a431d6;hb=1d9d92ba957a0b8307c9a65c35867fde68e6533b;hp=04a9aa26844a09bf941210a08ac8281d49eb95be;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec;p=pdclib diff --git a/functions/stdio/fclose.c b/functions/stdio/fclose.c index 04a9aa2..f672fb0 100644 --- a/functions/stdio/fclose.c +++ b/functions/stdio/fclose.c @@ -1,8 +1,43 @@ -// ---------------------------------------------------------------------------- -// $Id$ -// ---------------------------------------------------------------------------- -// Public Domain C Library - http://pdclib.sourceforge.net -// This code is Public Domain. Use, modify, and redistribute at will. -// ---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------------- + * Public Domain C Library - http://pdclib.sourceforge.net + * This code is Public Domain. Use, modify, and redistribute at will. + * --------------------------------------------------------------------------*/ int fclose( FILE * stream ) { /* TODO */ }; + +/* PDPC code - unreviewed. +Read the note in fopen.c. +int fclose(FILE *stream) +{ +#ifdef __OS2__ + APIRET rc; +#endif + + fflush(stream); +#ifdef __OS2__ + rc = DosClose(stream->hfile); +#endif +#ifdef __MSDOS__ + __close(stream->hfile); +#endif +#ifdef __MVS__ + __aclose(stream->hfile); +#endif + __userFiles[stream->intFno] = NULL; + if (!stream->theirBuffer) + { + free(stream->intBuffer); + } + free(stream); +#ifdef __OS2__ + if (rc != 0) + { + errno = rc; + return (EOF); + } +#endif + return (0); +} +*/