diff options
author | rsc <devnull@localhost> | 2003-12-03 22:50:48 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-12-03 22:50:48 +0000 |
commit | 669250d159e93a6933afa4cd25f410af801515ec (patch) | |
tree | 1f053fd518cf1a172863e07050e6e3bf13762f7d /src/libbio | |
parent | 5a82f26e50fbfbb3090b4cf839decf012637a00e (diff) | |
download | plan9port-669250d159e93a6933afa4cd25f410af801515ec.tar.gz plan9port-669250d159e93a6933afa4cd25f410af801515ec.tar.bz2 plan9port-669250d159e93a6933afa4cd25f410af801515ec.zip |
Various fixes.
B - fixed usage, DISPLAY :0 vs :0.0
9term - fixed various terminal things
rc - notice traps in Read
_p9dir - only run disk code for disks
dirread - getdirentries on FreeBSD and Linux
are different w.r.t. meaning of off.
notify - set up so signals interrupt system calls
bprint - use bfmt.
Diffstat (limited to 'src/libbio')
-rw-r--r-- | src/libbio/bcat.c | 4 | ||||
-rw-r--r-- | src/libbio/bprint.c | 28 | ||||
-rw-r--r-- | src/libbio/mkfile | 5 |
3 files changed, 17 insertions, 20 deletions
diff --git a/src/libbio/bcat.c b/src/libbio/bcat.c index dea346a5..7c9b39e9 100644 --- a/src/libbio/bcat.c +++ b/src/libbio/bcat.c @@ -22,8 +22,12 @@ main(int argc, char **argv) { int i; Biobuf b, *bp; + Fmt fmt; Binit(&bout, 1, O_WRONLY); + Bfmtinit(&fmt, &bout); + fmtprint(&fmt, "hello, world\n"); + Bfmtflush(&fmt); if(argc == 1){ Binit(&b, 0, O_RDONLY); diff --git a/src/libbio/bprint.c b/src/libbio/bprint.c index 81e71e5e..2b66605c 100644 --- a/src/libbio/bprint.c +++ b/src/libbio/bprint.c @@ -4,25 +4,17 @@ int Bprint(Biobuf *bp, char *fmt, ...) { - va_list ap; - char *ip, *ep, *out; + va_list args; + Fmt f; int n; - ep = (char*)bp->ebuf; - ip = ep + bp->ocount; - va_start(ap, fmt); - out = vseprint(ip, ep, fmt, ap); - va_end(ap); - if(out == 0 || out >= ep-5) { - Bflush(bp); - ip = ep + bp->ocount; - va_start(ap, fmt); - out = vseprint(ip, ep, fmt, ap); - va_end(ap); - if(out >= ep-5) - return Beof; - } - n = out-ip; - bp->ocount += n; + if(Bfmtinit(&f, bp) < 0) + return -1; + va_start(args, fmt); + f.args = args; + n = dofmt(&f, fmt); + va_end(args); + if(n > 0 && Bfmtflush(&f) < 0) + return -1; return n; } diff --git a/src/libbio/mkfile b/src/libbio/mkfile index 2c64b257..e808b178 100644 --- a/src/libbio/mkfile +++ b/src/libbio/mkfile @@ -7,6 +7,7 @@ OFILES=\ bbuffered.$O\ bfildes.$O\ bflush.$O\ + bfmt.$O\ bgetc.$O\ bgetd.$O\ binit.$O\ @@ -26,6 +27,6 @@ HFILES=\ <$PLAN9/src/mksyslib -bcat: bcat.$O $LIB - $CC -o bcat bcat.$O -L$PLAN9/lib -lbio -lfmt -lutf +bcat: bcat.$O $PLAN9/lib/$LIB + $LD -o bcat bcat.$O -lbio -lfmt -lutf |