Don't try to setup and use X11 shared memory if
[tangerine.git] / compiler / clib / fgetc.c
blob08eb133cc02a6206a6df56419b65223109f616c8
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function fgetc().
6 */
8 #include <errno.h>
9 #include <dos/dos.h>
10 #include <dos/dosextens.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
13 #include "__errno.h"
14 #include "__open.h"
17 /*****************************************************************************
19 NAME */
20 #include <stdio.h>
22 int fgetc (
24 /* SYNOPSIS */
25 FILE * stream)
27 /* FUNCTION
28 Read one character from the stream. If there is no character
29 available or an error occurred, the function returns EOF.
31 INPUTS
32 stream - Read from this stream
34 RESULT
35 The character read or EOF on end of file or error.
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 getc(), fputc(), putc()
46 INTERNALS
48 ******************************************************************************/
50 int c;
51 fdesc *fdesc = __getfdesc(stream->fd);
53 if (!fdesc)
55 errno = EBADF;
56 stream->flags |= _STDIO_ERROR;
57 return EOF;
60 /* Note: changes here might require changes in vfscanf.c!! */
62 c = FGetC ((BPTR)(fdesc->fcb->fh));
63 if (c == EOF)
65 c = IoErr ();
67 if (c)
69 errno = IoErr2errno (c);
71 stream->flags |= _STDIO_ERROR;
73 else
74 stream->flags |= _STDIO_EOF;
76 c = EOF;
79 return c;
80 } /* fgetc */