OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [loader/] [libs/] [c/] [src/] [fputc.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
#include <stdio.h>
2
 
3
int
4
fputc(int c, FILE *stream)
5
{
6
        unsigned char ch = (unsigned char) c;
7
        /* This is where we should do output buffering */
8
 
9
        lock_stream(stream);
10
        if (stream->write_fn(&ch, stream->current_pos, 1, stream->handle) == 1) {
11
                /* Success */
12
                stream->current_pos++;
13
                unlock_stream(stream);
14
                return c;
15
        } else {
16
                unlock_stream(stream);
17
                return EOF;
18
        }
19
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.