xd: use new bio magic to make -u more efficient
This commit is contained in:
parent
1a40bdeb84
commit
fff474d863
|
@ -58,6 +58,13 @@ char *afmt[2][3] = {
|
||||||
Biobuf bin;
|
Biobuf bin;
|
||||||
Biobuf bout;
|
Biobuf bout;
|
||||||
|
|
||||||
|
int
|
||||||
|
flushout(Biobufhdr *bp, void *v, long n)
|
||||||
|
{
|
||||||
|
Bflush(&bout);
|
||||||
|
return read(bp->fid, v, n);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -206,6 +213,7 @@ xd(char *name, int title)
|
||||||
bp = &bin;
|
bp = &bin;
|
||||||
Binit(bp, fd, OREAD);
|
Binit(bp, fd, OREAD);
|
||||||
}
|
}
|
||||||
|
if(flush) Biofn(bp, flushout);
|
||||||
Blethal(bp, nil);
|
Blethal(bp, nil);
|
||||||
if(title)
|
if(title)
|
||||||
xprint("%s\n", name);
|
xprint("%s\n", name);
|
||||||
|
@ -237,15 +245,11 @@ xd(char *name, int title)
|
||||||
xprint(ap->afmt, addr);
|
xprint(ap->afmt, addr);
|
||||||
(*ap->fn)(ap->fmt);
|
(*ap->fn)(ap->fmt);
|
||||||
xprint("\n", 0);
|
xprint("\n", 0);
|
||||||
if(flush)
|
|
||||||
Bflush(&bout);
|
|
||||||
}
|
}
|
||||||
addr += ndata;
|
addr += ndata;
|
||||||
if(ndata<16){
|
if(ndata<16){
|
||||||
xprint(afmt[0][abase], addr);
|
xprint(afmt[0][abase], addr);
|
||||||
xprint("\n", 0);
|
xprint("\n", 0);
|
||||||
if(flush)
|
|
||||||
Bflush(&bout);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue