merge
This commit is contained in:
commit
d72757f7b1
12 changed files with 28 additions and 4 deletions
|
@ -4519,3 +4519,8 @@ There are other open source projects that have implemented something similar, an
|
|||
This is awesome. I feel the same way and have for years.
|
||||
what is going to happen to everybodys computers?
|
||||
rockets are like bootloaders, they have multiple stages and explode half of the time -- aiju
|
||||
The gun is good. The penis is evil. The penis shoots seeds, and makes new life to poison the Earth with a plague of men, as once it was, but the gun shoots death, and purifies the Earth of the filth of brutals. Go forth ... and kill!
|
||||
ERROR: If you can see this, then YouTube is down or you don't have Flash installed.
|
||||
The probe, which criticized the US Army for turning a blind eye to Blackwater abuses, found that in one incident a US officer signed over hundreds of AK-47s intended for Afghan forces to an individual from Blackwater's Counter Narcotics Training Unit who signed for them as "Eric Cartman."
|
||||
Finding your own problem is where everything interesting starts. -- Momus
|
||||
Stanford CS101 Adopts JavaScript
|
||||
|
|
|
@ -32,6 +32,7 @@ struct Biobufhdr
|
|||
uchar* bbuf; /* pointer to beginning of buffer */
|
||||
uchar* ebuf; /* pointer to end of buffer */
|
||||
uchar* gbuf; /* pointer to good data in buf */
|
||||
void (*errorf)(char *); /* called on error if not nil */
|
||||
};
|
||||
|
||||
struct Biobuf
|
||||
|
@ -70,5 +71,7 @@ int Bterm(Biobufhdr*);
|
|||
int Bungetc(Biobufhdr*);
|
||||
int Bungetrune(Biobufhdr*);
|
||||
long Bwrite(Biobufhdr*, void*, long);
|
||||
void Blethal(Biobufhdr*, void(*)(char*));
|
||||
void Berror(Biobufhdr*, char*, ...);
|
||||
|
||||
#pragma varargck argpos Bprint 2
|
||||
|
|
|
@ -199,6 +199,7 @@ outcode(void)
|
|||
return;
|
||||
}
|
||||
Binit(&b, f, OWRITE);
|
||||
Blethal(&b, nil);
|
||||
Bseek(&b, 0L, 2);
|
||||
outhist(&b);
|
||||
for(sym=0; sym<NSYM; sym++) {
|
||||
|
|
|
@ -1262,7 +1262,9 @@ loop:
|
|||
if(i->f < 0)
|
||||
goto pop;
|
||||
fi.c = read(i->f, i->b, BUFSIZ) - 1;
|
||||
if(fi.c < 0) {
|
||||
if(fi.c < -1)
|
||||
sysfatal("read error: %r");
|
||||
if(fi.c == -1) {
|
||||
close(i->f);
|
||||
linehist(0, 0);
|
||||
goto pop;
|
||||
|
|
|
@ -20,6 +20,7 @@ Bflush(Biobufhdr *bp)
|
|||
}
|
||||
bp->state = Binactive;
|
||||
bp->ocount = 0;
|
||||
Berror(bp, "write error: %r");
|
||||
break;
|
||||
|
||||
case Bracteof:
|
||||
|
|
|
@ -28,8 +28,10 @@ loop:
|
|||
bp->gbuf = bp->bbuf;
|
||||
if(i <= 0) {
|
||||
bp->state = Bracteof;
|
||||
if(i < 0)
|
||||
if(i < 0) {
|
||||
bp->state = Binactive;
|
||||
Berror(bp, "read error: %r");
|
||||
}
|
||||
return Beof;
|
||||
}
|
||||
if(i < bp->bsize) {
|
||||
|
|
|
@ -83,6 +83,7 @@ Binits(Biobufhdr *bp, int f, int mode, uchar *p, int size)
|
|||
bp->rdline = 0;
|
||||
bp->offset = 0;
|
||||
bp->runesize = 0;
|
||||
bp->errorf = nil;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ Brdline(Biobufhdr *bp, int delim)
|
|||
ip = (char*)bp->bbuf + i;
|
||||
while(i < bp->bsize) {
|
||||
j = read(bp->fid, ip, bp->bsize-i);
|
||||
if(j < 0)
|
||||
Berror(bp, "read error: %r");
|
||||
if(j <= 0) {
|
||||
/*
|
||||
* end of file with no delim
|
||||
|
|
|
@ -67,6 +67,8 @@ Brdstr(Biobufhdr *bp, int delim, int nulldelim)
|
|||
ip = (char*)bp->bbuf + i;
|
||||
while(i < bp->bsize) {
|
||||
j = read(bp->fid, ip, bp->bsize-i);
|
||||
if(j < 0)
|
||||
Berror(bp, "read error: %r");
|
||||
if(j <= 0 && i == 0)
|
||||
return p;
|
||||
if(j <= 0 && i > 0){
|
||||
|
|
|
@ -23,8 +23,10 @@ Bread(Biobufhdr *bp, void *ap, long count)
|
|||
i = read(bp->fid, bp->bbuf, bp->bsize);
|
||||
if(i <= 0) {
|
||||
bp->state = Bracteof;
|
||||
if(i < 0)
|
||||
if(i < 0) {
|
||||
Berror(bp, "read error: %r");
|
||||
bp->state = Binactive;
|
||||
}
|
||||
break;
|
||||
}
|
||||
bp->gbuf = bp->bbuf;
|
||||
|
|
|
@ -24,8 +24,10 @@ Bwrite(Biobufhdr *bp, void *ap, long count)
|
|||
i = write(bp->fid, bp->bbuf, bp->bsize);
|
||||
if(i != bp->bsize) {
|
||||
errstr(errbuf, sizeof errbuf);
|
||||
if(strstr(errbuf, "interrupt") == nil)
|
||||
if(strstr(errbuf, "interrupt") == nil) {
|
||||
bp->state = Binactive;
|
||||
Berror(bp, "write error: %s", errbuf);
|
||||
}
|
||||
errstr(errbuf, sizeof errbuf);
|
||||
return Beof;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ OFILES=\
|
|||
bgetc.$O\
|
||||
bgetd.$O\
|
||||
binit.$O\
|
||||
blethal.$O\
|
||||
boffset.$O\
|
||||
bprint.$O\
|
||||
bputrune.$O\
|
||||
|
|
Loading…
Reference in a new issue