Upgraded GRUB2 to 2.00 release.
[AROS.git] / compiler / clib / fclose.c
blob9c7f5bca8bc61b9dd2e9096b821732645ad390d6
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function fclose().
6 */
8 #include <proto/exec.h>
9 #include <proto/dos.h>
10 #include <stdlib.h>
11 #include <unistd.h>
12 #include "__stdio.h"
14 #include "__arosc_privdata.h"
16 /*****************************************************************************
18 NAME */
19 #include <stdio.h>
21 int fclose (
23 /* SYNOPSIS */
24 FILE * stream)
26 /* FUNCTION
27 Closes a stream.
29 INPUTS
30 stream - Stream to close.
32 RESULT
33 Upon successful completion 0 is returned. Otherwise, EOF is
34 returned and the global variable errno is set to indicate the
35 error. In either case no further access to the stream is possible.
37 NOTES
38 This function must not be used in a shared library or
39 in a threaded application.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 fopen(), open(), close()
48 INTERNALS
50 ******************************************************************************/
52 struct aroscbase *aroscbase = __aros_getbase();
53 FILENODE * fn;
55 if (close(stream->fd) == -1)
56 return EOF;
58 fn = FILE2FILENODE (stream);
59 Remove ((struct Node *)fn);
61 FreePooled(aroscbase->acb_internalpool, fn, sizeof(FILENODE));
63 return 0;
64 } /* fclose */