/* * generate ls-R listings for /sys/lib/texmf indices * supposed to mimic unix's ls -LAR which looks approximately like this: ./file1 ./file2 ./file3 ./dir1: fileindir1 file2indir1 ./dir2: fileindir2 ./dir2/dir3: fileindir2dir3 * * and they want some silly comment at the top: * % ls-R -- filename database for kpathsea; do not change this line. */ #include #include #include void lsr(char *prefix, int hdr) { char *nprefix; int i, fd, n, len; Dir *dbuf; if(hdr) print("\n%s:\n", prefix); fd = open(".", OREAD); if(fd < 0) { fprint(2, "warning: could not read directory %s\n", prefix); return; } while((n = dirread(fd, &dbuf)) > 0) { for(i=0; i 0) { for(i=0; i