diff options
author | cinap_lenrek <cinap_lenrek@localhost> | 2011-07-12 20:24:55 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@localhost> | 2011-07-12 20:24:55 +0200 |
commit | d72757f7b190bced15df66296d86c92a0ef1d307 (patch) | |
tree | 6eeed8ff6c5dd3ef5f96d6ba2dd0645ef207d406 /sys | |
parent | ca4adfc25048e99a0063d8fd06f4b2bb2ded4c8f (diff) | |
parent | bc2fc553b81c86fc10501cf668ae62120ad7d35b (diff) |
merge
Diffstat (limited to 'sys')
-rw-r--r-- | sys/games/lib/fortunes | 5 | ||||
-rw-r--r-- | sys/include/bio.h | 3 | ||||
-rw-r--r-- | sys/src/cmd/8c/swt.c | 1 | ||||
-rw-r--r-- | sys/src/cmd/cc/lex.c | 4 | ||||
-rw-r--r-- | sys/src/libbio/bflush.c | 1 | ||||
-rw-r--r-- | sys/src/libbio/bgetc.c | 4 | ||||
-rw-r--r-- | sys/src/libbio/binit.c | 1 | ||||
-rw-r--r-- | sys/src/libbio/brdline.c | 2 | ||||
-rw-r--r-- | sys/src/libbio/brdstr.c | 2 | ||||
-rw-r--r-- | sys/src/libbio/bread.c | 4 | ||||
-rw-r--r-- | sys/src/libbio/bwrite.c | 4 | ||||
-rw-r--r-- | sys/src/libbio/mkfile | 1 |
12 files changed, 28 insertions, 4 deletions
diff --git a/sys/games/lib/fortunes b/sys/games/lib/fortunes index cbf96a408..96cdb969e 100644 --- a/sys/games/lib/fortunes +++ b/sys/games/lib/fortunes @@ -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 diff --git a/sys/include/bio.h b/sys/include/bio.h index 4782932e3..f358c962c 100644 --- a/sys/include/bio.h +++ b/sys/include/bio.h @@ -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 diff --git a/sys/src/cmd/8c/swt.c b/sys/src/cmd/8c/swt.c index 46fd71eb4..d2c48b40a 100644 --- a/sys/src/cmd/8c/swt.c +++ b/sys/src/cmd/8c/swt.c @@ -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++) { diff --git a/sys/src/cmd/cc/lex.c b/sys/src/cmd/cc/lex.c index 2652cb8f8..74054aa22 100644 --- a/sys/src/cmd/cc/lex.c +++ b/sys/src/cmd/cc/lex.c @@ -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; diff --git a/sys/src/libbio/bflush.c b/sys/src/libbio/bflush.c index d4339eea7..44b0d59a9 100644 --- a/sys/src/libbio/bflush.c +++ b/sys/src/libbio/bflush.c @@ -20,6 +20,7 @@ Bflush(Biobufhdr *bp) } bp->state = Binactive; bp->ocount = 0; + Berror(bp, "write error: %r"); break; case Bracteof: diff --git a/sys/src/libbio/bgetc.c b/sys/src/libbio/bgetc.c index 1119c4517..0cabc0716 100644 --- a/sys/src/libbio/bgetc.c +++ b/sys/src/libbio/bgetc.c @@ -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) { diff --git a/sys/src/libbio/binit.c b/sys/src/libbio/binit.c index 75cee333b..ef705e667 100644 --- a/sys/src/libbio/binit.c +++ b/sys/src/libbio/binit.c @@ -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; } diff --git a/sys/src/libbio/brdline.c b/sys/src/libbio/brdline.c index c116e3859..4168d1e10 100644 --- a/sys/src/libbio/brdline.c +++ b/sys/src/libbio/brdline.c @@ -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 diff --git a/sys/src/libbio/brdstr.c b/sys/src/libbio/brdstr.c index b5727ad2a..a1b14f885 100644 --- a/sys/src/libbio/brdstr.c +++ b/sys/src/libbio/brdstr.c @@ -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){ diff --git a/sys/src/libbio/bread.c b/sys/src/libbio/bread.c index 9780ffac1..8e57d8e07 100644 --- a/sys/src/libbio/bread.c +++ b/sys/src/libbio/bread.c @@ -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; diff --git a/sys/src/libbio/bwrite.c b/sys/src/libbio/bwrite.c index ae7a7d97c..03f46779b 100644 --- a/sys/src/libbio/bwrite.c +++ b/sys/src/libbio/bwrite.c @@ -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; } diff --git a/sys/src/libbio/mkfile b/sys/src/libbio/mkfile index a8c21dbaa..3b40fd25c 100644 --- a/sys/src/libbio/mkfile +++ b/sys/src/libbio/mkfile @@ -9,6 +9,7 @@ OFILES=\ bgetc.$O\ bgetd.$O\ binit.$O\ + blethal.$O\ boffset.$O\ bprint.$O\ bputrune.$O\ |