scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <errno.h>
 2#include <stdio.h>
 3
 4#include "../libc.h"
 5#include "../syscall.h"
 6
 7int
 8_flsbuf(FILE *fp)
 9{
10	size_t cnt;
11
12	if (fp->flags&_IOREAD)
13		return 0;
14
15	cnt = fp->wp - fp->buf;
16	if (cnt > 0 && _write(fp->fd, fp->buf, cnt) != cnt) {
17		fp->flags |= _IOERR;
18		return EOF;
19	}
20	fp->wp = fp->buf;
21
22	return 0;
23}