hbase

heirloom base
git clone git://git.2f30.org/hbase
Log | Files | Refs | README

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 }