bputc.c - 9base - revived minimalist port of Plan 9 userland to Unix
(HTM) git clone git://git.suckless.org/9base
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
bputc.c (227B)
---
1 #include "lib9.h"
2 #include <bio.h>
3
4 int
5 Bputc(Biobuf *bp, int c)
6 {
7 int i;
8
9 for(;;) {
10 i = bp->ocount;
11 if(i) {
12 bp->ebuf[i++] = c;
13 bp->ocount = i;
14 return 0;
15 }
16 if(Bflush(bp) == Beof)
17 break;
18 }
19 return Beof;
20 }