home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/stdio/c/RCS/fclose,v $
- * $Date: 1996/05/06 09:01:34 $
- * $Revision: 1.2 $
- * $State: Rel $
- * $Author: unixlib $
- *
- * $Log: fclose,v $
- * Revision 1.2 1996/05/06 09:01:34 unixlib
- * Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
- * Saved for 3.7a release.
- *
- * Revision 1.1 1996/04/19 21:32:42 simon
- * Initial revision
- *
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id: fclose,v 1.2 1996/05/06 09:01:34 unixlib Rel $";
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <fcntl.h>
-
- __STDIOLIB__
-
- int
- fclose (register FILE * f)
- {
- if (fflush (f))
- return (-1);
-
- if (f->i_base)
- free (f->i_base);
- if (f->o_base)
- free (f->o_base);
-
- if (close (f->fd))
- return (-1);
-
- f->flag = 0;
-
- return (0);
- }
-