]> pd.if.org Git - pdclib/blob - functions/stdio/fgetc.c
Comment cleanups.
[pdclib] / functions / stdio / fgetc.c
1 /* fgetc( FILE * )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <stdio.h>
8
9 #ifndef REGTEST
10
11 #include <_PDCLIB_glue.h>
12
13 int fgetc( struct _PDCLIB_file_t * stream )
14 {
15     if ( _PDCLIB_prepread( stream ) == EOF )
16     {
17         return EOF;
18     }
19     if ( stream->ungetidx > 0 )
20     {
21         return (unsigned char)stream->ungetbuf[ --(stream->ungetidx) ];
22     }
23     return (unsigned char)stream->buffer[stream->bufidx++];
24 }
25
26 #endif
27
28 #ifdef TEST
29 #include <_PDCLIB_test.h>
30
31 int main( void )
32 {
33     /* Testing covered by ftell.c */
34     return TEST_RESULTS;
35 }
36
37 #endif