tmake -> mk. - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 986b36bccd134726eea42f2cfabff2943d729ac4
 (DIR) parent f365e600d41badc64b7a13ba385eb876d381abaa
 (HTM) Author: rsc <devnull@localhost>
       Date:   Sun, 23 Nov 2003 18:14:35 +0000
       
       make -> mk.
       
       add Bfdopen.
       
       Diffstat:
         M include/bio.h                       |       1 +
         D src/libbio/Makefile                 |      31 -------------------------------
         M src/libbio/binit.c                  |      19 +++++++++++++++----
         A src/libbio/mkfile                   |      31 +++++++++++++++++++++++++++++++
       
       4 files changed, 47 insertions(+), 35 deletions(-)
       ---
 (DIR) diff --git a/include/bio.h b/include/bio.h
       t@@ -55,6 +55,7 @@ struct        Biobuf
                (bp)->fid
        
        int        Bbuffered(Biobuf*);
       +Biobuf*        Bfdopen(int, int);
        int        Bfildes(Biobuf*);
        int        Bflush(Biobuf*);
        int        Bgetc(Biobuf*);
 (DIR) diff --git a/src/libbio/Makefile b/src/libbio/Makefile
       t@@ -1,31 +0,0 @@
       -PLAN9=../..
       -include $(PLAN9)/src/Makehdr
       -
       -LIB=libbio.a
       -
       -OFILES=\
       -        bbuffered.$O\
       -        bfildes.$O\
       -        bflush.$O\
       -        bgetc.$O\
       -        bgetd.$O\
       -        binit.$O\
       -        boffset.$O\
       -        bprint.$O\
       -        bputc.$O\
       -        brdline.$O\
       -        brdstr.$O\
       -        bread.$O\
       -        bseek.$O\
       -        bwrite.$O\
       -        bgetrune.$O\
       -        bputrune.$O\
       -
       -HFILES=\
       -        $(PLAN9)/include/bio.h\
       -
       -include $(PLAN9)/src/Makesyslib
       -
       -bcat: bcat.$O $(LIB)
       -        $(CC) -o bcat bcat.$O -L$(PLAN9)/lib -lbio -lfmt -lutf
       -
 (DIR) diff --git a/src/libbio/binit.c b/src/libbio/binit.c
       t@@ -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;
       t@@ -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;
        }
        
 (DIR) diff --git a/src/libbio/mkfile b/src/libbio/mkfile
       t@@ -0,0 +1,31 @@
       +PLAN9=../..
       +<$PLAN9/src/mkhdr
       +
       +LIB=libbio.a
       +
       +OFILES=\
       +        bbuffered.$O\
       +        bfildes.$O\
       +        bflush.$O\
       +        bgetc.$O\
       +        bgetd.$O\
       +        binit.$O\
       +        boffset.$O\
       +        bprint.$O\
       +        bputc.$O\
       +        brdline.$O\
       +        brdstr.$O\
       +        bread.$O\
       +        bseek.$O\
       +        bwrite.$O\
       +        bgetrune.$O\
       +        bputrune.$O\
       +
       +HFILES=\
       +        $PLAN9/include/bio.h\
       +
       +<$PLAN9/src/mksyslib
       +
       +bcat: bcat.$O $LIB
       +        $CC -o bcat bcat.$O -L$PLAN9/lib -lbio -lfmt -lutf
       +