blob: b816f7c4ddf918e958524e36cb10d9d76ecac628 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <dietstdio.h>
#ifndef WANT_BUFFERED_STDIO
#include <unistd.h>
#endif
int fputc(int c, FILE *stream) {
#ifdef WANT_BUFFERED_STDIO
if (__fflush4(stream,0)) return EOF;
if (stream->bm>=BUFSIZE-1)
if (fflush(stream)) return EOF;
stream->buf[stream->bm]=c;
++stream->bm;
if ((stream->flags&BUFLINEWISE) && c=='\n') /* puke */
if (fflush(stream)) return EOF;
#else
write(stream->fd,&c,1);
#endif
return 0;
}
|