src: use whatis instead of which

This commit is contained in:
Michael Teichgräber 2009-07-08 09:18:42 -07:00
parent bb7ff349fb
commit 4a18fa68b0
3 changed files with 15 additions and 7 deletions

View file

@ -49,7 +49,7 @@ if(~ $#* 0) usage
ifs=' ifs='
' '
for(i){ for(i){
wi=`{which $i >[2]/dev/null} wi=`{whatis $i >[2]/dev/null}
if(test -f $i) go $i if(test -f $i) go $i
if not if(~ $#wi 1 && test -f $wi) go $wi if not if(~ $#wi 1 && test -f $wi) go $wi
if not echo 'src: can''t find '$i if not echo 'src: can''t find '$i

View file

@ -194,7 +194,7 @@ execute(Text *t, uint aq0, uint aq1, int external, Text *argt)
if(strlen(a) > EVENTSIZE){ /* too big; too bad */ if(strlen(a) > EVENTSIZE){ /* too big; too bad */
free(aa); free(aa);
free(a); free(a);
warning(nil, "`argument string too long\n"); warning(nil, "argument string too long\n");
return; return;
} }
f |= 8; f |= 8;

View file

@ -1788,6 +1788,7 @@ vacfsopen(VtConn *z, char *file, int mode, ulong cachemem)
} }
close(fd); close(fd);
} }
fprint(2, "vacfsopen %V\n", score);
return vacfsopenscore(z, score, mode, cachemem); return vacfsopenscore(z, score, mode, cachemem);
} }
@ -1803,17 +1804,23 @@ vacfsopenscore(VtConn *z, u8int *score, int mode, ulong cachemem)
VtEntry e; VtEntry e;
n = vtread(z, score, VtRootType, buf, VtRootSize); n = vtread(z, score, VtRootType, buf, VtRootSize);
if(n < 0) if(n < 0) {
fprint(2, "read %r\n");
return nil; return nil;
}
if(n != VtRootSize){ if(n != VtRootSize){
werrstr("vtread on root too short"); werrstr("vtread on root too short");
fprint(2, "size %d\n", n);
return nil; return nil;
} }
if(vtrootunpack(&rt, buf) < 0) if(vtrootunpack(&rt, buf) < 0) {
fprint(2, "unpack: %r\n");
return nil; return nil;
}
if(strcmp(rt.type, "vac") != 0) { if(strcmp(rt.type, "vac") != 0) {
fprint(2, "bad type %s\n", rt.type);
werrstr("not a vac root"); werrstr("not a vac root");
return nil; return nil;
} }
@ -1825,13 +1832,14 @@ vacfsopenscore(VtConn *z, u8int *score, int mode, ulong cachemem)
memmove(e.score, rt.score, VtScoreSize); memmove(e.score, rt.score, VtScoreSize);
e.gen = 0; e.gen = 0;
// Don't waste cache memory on directories // Don't waste cache memory on pointer blocks
// when rt.blocksize is large. // when rt.blocksize is large.
e.psize = (rt.blocksize/VtEntrySize)*VtEntrySize; e.psize = (rt.blocksize/VtEntrySize)*VtEntrySize;
if(e.psize > 60000) if(e.psize > 60000)
e.psize = (60000/VtEntrySize)*VtEntrySize; e.psize = (60000/VtEntrySize)*VtEntrySize;
e.dsize = rt.blocksize; e.dsize = rt.blocksize;
fprint(2, "openscore %d psize %d dsize %d\n", (int)rt.blocksize, (int)e.psize, (int)e.dsize);
e.type = VtDirType; e.type = VtDirType;
e.flags = VtEntryActive; e.flags = VtEntryActive;
e.size = 3*VtEntrySize; e.size = 3*VtEntrySize;
@ -1949,9 +1957,9 @@ vacfscreate(VtConn *z, int bsize, ulong cachemem)
/* /*
* Fake up an empty vac fs. * Fake up an empty vac fs.
*/ */
psize = bsize/VtEntrySize*VtEntrySize; psize = bsize/VtScoreSize*VtScoreSize;
if(psize > 60000) if(psize > 60000)
psize = 60000/VtEntrySize*VtEntrySize; psize = 60000/VtScoreSize*VtScoreSize;
fprint(2, "create bsize %d psize %d\n", bsize, psize); fprint(2, "create bsize %d psize %d\n", bsize, psize);
f = vtfilecreateroot(fs->cache, psize, bsize, VtDirType); f = vtfilecreateroot(fs->cache, psize, bsize, VtDirType);