diff options
author | rsc <devnull@localhost> | 2005-05-12 14:03:57 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-05-12 14:03:57 +0000 |
commit | 52006c82447f374388721bc8eeadd5d463cb95b2 (patch) | |
tree | fb224d2c9d8b4c9e867d6307d3c79e0c29b86c44 /src/libventi | |
parent | 6a4599d779d306a292f2437f99b5d7df6a41b313 (diff) | |
download | plan9port-52006c82447f374388721bc8eeadd5d463cb95b2.tar.gz plan9port-52006c82447f374388721bc8eeadd5d463cb95b2.tar.bz2 plan9port-52006c82447f374388721bc8eeadd5d463cb95b2.zip |
add vtlognames
Diffstat (limited to 'src/libventi')
-rw-r--r-- | src/libventi/log.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libventi/log.c b/src/libventi/log.c index 511a7f2a..02f3aa39 100644 --- a/src/libventi/log.c +++ b/src/libventi/log.c @@ -30,6 +30,41 @@ hash(char *s) return h; } +char** +vtlognames(int *pn) +{ + int i, nname, size; + VtLog *l; + char **s, *a, *e; + + qlock(&vl.lk); + size = 0; + nname = 0; + for(i=0; i<nelem(vl.hash); i++) + for(l=vl.hash[i]; l; l=l->next){ + nname++; + size += strlen(l->name)+1; + } + + s = vtmalloc(nname*sizeof(char*)+size); + a = (char*)(s+nname); + e = (char*)s+nname*sizeof(char*)+size; + + size = 0; + nname = 0; + for(i=0; i<nelem(vl.hash); i++) + for(l=vl.hash[i]; l; l=l->next){ + strcpy(a, l->name); + s[nname++] = a; + a += strlen(a)+1; + } + *pn = nname; + assert(a == e); + qunlock(&vl.lk); + + return s; +} + VtLog* vtlogopen(char *name, uint size) { |