Plan 9 from Bell Labs’s /usr/web/sources/contrib/yk/lab/git/bio.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include	<u.h>
#include	<libc.h>
#include	<bio.h>

Biobuf*
Bfdopen(int fd, int mode)
{
	Biobuf *bp;

	bp = malloc(sizeof(Biobuf));
	if(bp == nil)
		return nil;
	if(Binits(bp, fd, mode, bp->b, sizeof(bp->b)) != 0){
		free(bp);
		return nil;
	}
	bp->flag = Bmagic;			/* mark bp open & malloced */
	setmalloctag(bp, getcallerpc(&fd));
	return bp;
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].