tools/toollib: remove from main Makefile.in
[AROS.git] / compiler / posixc / fclose.c
blob0b2f6f3a977e0635e47032c7073ee720c38de927
1 /*
2 Copyright © 1995-2013, 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 "__posixc_intbase.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
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 fopen(), open(), close()
46 INTERNALS
48 ******************************************************************************/
50 struct PosixCIntBase *PosixCBase =
51 (struct PosixCIntBase *)__aros_getbase_PosixCBase();
52 FILENODE * fn;
54 if (close(stream->fd) == -1)
55 return EOF;
57 fn = FILE2FILENODE (stream);
58 Remove ((struct Node *)fn);
60 FreePooled(PosixCBase->internalpool, fn, sizeof(FILENODE));
62 return 0;
63 } /* fclose */