Introduction
Introduction Statistics Contact Development Disclaimer Help
tadd bfmt. - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit b0be3b88261ddf09aaeca5c287f1b9ca26ccb558
parent 669250d159e93a6933afa4cd25f410af801515ec
Author: rsc <devnull@localhost>
Date: Wed, 3 Dec 2003 22:51:11 +0000
add bfmt.
Diffstat:
A src/libbio/bfmt.c | 37 +++++++++++++++++++++++++++++…
1 file changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/libbio/bfmt.c b/src/libbio/bfmt.c
t@@ -0,0 +1,37 @@
+#include "lib9.h"
+#include <bio.h>
+
+static int
+_Bfmtflush(Fmt *f)
+{
+ Biobuf *b;
+
+ b = f->farg;
+ b->ocount = f->to - f->stop;
+ if(Bflush(b) < 0)
+ return 0;
+ f->to = b->ebuf+b->ocount;
+ return 1;
+}
+
+int
+Bfmtinit(Fmt *f, Biobuf *b)
+{
+ if(b->state != Bwactive)
+ return -1;
+ memset(f, 0, sizeof *f);
+ f->farg = b;
+ f->start = b->bbuf;
+ f->to = b->ebuf+b->ocount;
+ f->stop = b->ebuf;
+ f->flush = _Bfmtflush;
+ return 0;
+}
+
+int
+Bfmtflush(Fmt *f)
+{
+ if(_Bfmtflush(f) <= 0)
+ return -1;
+ return f->nfmt;
+}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.