blob: 6441c5741dd93f65875d9442dea43004eafbebfc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <dietstdio.h>
#include <unistd.h>
int fputc_unlocked(int c, FILE *stream) {
if (__fflush4(stream,0)) return EOF;
if (stream->bm>=stream->buflen-1)
if (fflush(stream)) return EOF;
if (stream->flags&NOBUF) {
if (write(stream->fd,&c,1) != 1) return EOF;
return 0;
}
stream->buf[stream->bm]=c;
++stream->bm;
if (((stream->flags&BUFLINEWISE) && c=='\n') ||
((stream->flags&NOBUF))) /* puke */
if (fflush(stream)) return EOF;
return 0;
}
int fputc(int c,FILE* stream) __attribute__((weak,alias("fputc_unlocked")));
|