diff options
author | rsc <devnull@localhost> | 2003-11-23 18:14:35 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-11-23 18:14:35 +0000 |
commit | 986b36bccd134726eea42f2cfabff2943d729ac4 (patch) | |
tree | 2adf8dbbe9576ac333ebdd3fb35522cdc4541776 /src/libbio | |
parent | f365e600d41badc64b7a13ba385eb876d381abaa (diff) | |
download | plan9port-986b36bccd134726eea42f2cfabff2943d729ac4.tar.gz plan9port-986b36bccd134726eea42f2cfabff2943d729ac4.tar.bz2 plan9port-986b36bccd134726eea42f2cfabff2943d729ac4.zip |
make -> mk.
add Bfdopen.
Diffstat (limited to 'src/libbio')
-rw-r--r-- | src/libbio/binit.c | 19 | ||||
-rw-r--r-- | src/libbio/mkfile (renamed from src/libbio/Makefile) | 10 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/libbio/binit.c b/src/libbio/binit.c index d76168b7..33bf5812 100644 --- a/src/libbio/binit.c +++ b/src/libbio/binit.c @@ -98,6 +98,19 @@ Binit(Biobuf *bp, int f, int mode) } Biobuf* +Bfdopen(int f, int mode) +{ + Biobuf *bp; + + bp = malloc(sizeof(Biobuf)); + if(bp == 0) + return 0; + Binits(bp, f, mode, bp->b, sizeof(bp->b)); + bp->flag = Bmagic; + return bp; +} + +Biobuf* Bopen(char *name, int mode) { Biobuf *bp; @@ -119,11 +132,9 @@ Bopen(char *name, int mode) if(f < 0) return 0; } - bp = malloc(sizeof(Biobuf)); + bp = Bfdopen(f, mode); if(bp == 0) - return 0; - Binits(bp, f, mode, bp->b, sizeof(bp->b)); - bp->flag = Bmagic; + close(f); return bp; } diff --git a/src/libbio/Makefile b/src/libbio/mkfile index f404f256..2c64b257 100644 --- a/src/libbio/Makefile +++ b/src/libbio/mkfile @@ -1,5 +1,5 @@ PLAN9=../.. -include $(PLAN9)/src/Makehdr +<$PLAN9/src/mkhdr LIB=libbio.a @@ -22,10 +22,10 @@ OFILES=\ bputrune.$O\ HFILES=\ - $(PLAN9)/include/bio.h\ + $PLAN9/include/bio.h\ -include $(PLAN9)/src/Makesyslib +<$PLAN9/src/mksyslib -bcat: bcat.$O $(LIB) - $(CC) -o bcat bcat.$O -L$(PLAN9)/lib -lbio -lfmt -lutf +bcat: bcat.$O $LIB + $CC -o bcat bcat.$O -L$PLAN9/lib -lbio -lfmt -lutf |