Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/src/libbio/bgetd.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <bio.h>
4
 
5
struct	bgetd
6
{
7
	Biobufhdr*	b;
8
	int		eof;
9
};
10
 
11
static int
12
Bgetdf(void *vp)
13
{
14
	int c;
15
	struct bgetd *bg = vp;
16
 
17
	c = Bgetc(bg->b);
18
	if(c == Beof)
19
		bg->eof = 1;
20
	return c;
21
}
22
 
23
int
24
Bgetd(Biobufhdr *bp, double *dp)
25
{
26
	double d;
27
	struct bgetd b;
28
 
29
	b.b = bp;
30
	b.eof = 0;
31
	d = charstod(Bgetdf, &b);
32
	if(b.eof)
33
		return -1;
34
	Bungetc(bp);
35
	*dp = d;
36
	return 1;
37
}