make -> mk.
add Bfdopen.
This commit is contained in:
parent
f365e600d4
commit
986b36bccd
3 changed files with 21 additions and 9 deletions
|
|
@ -55,6 +55,7 @@ struct Biobuf
|
|||
(bp)->fid
|
||||
|
||||
int Bbuffered(Biobuf*);
|
||||
Biobuf* Bfdopen(int, int);
|
||||
int Bfildes(Biobuf*);
|
||||
int Bflush(Biobuf*);
|
||||
int Bgetc(Biobuf*);
|
||||
|
|
|
|||
|
|
@ -97,6 +97,19 @@ Binit(Biobuf *bp, int f, int mode)
|
|||
return Binits(bp, f, mode, bp->b, sizeof(bp->b));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue