7 * Use this to start making an index for a new dictionary.
8 * Get the dictionary-specific nextoff and printentry(_,'h')
9 * commands working, add a record to the dicts[] array below,
10 * and run this program to get a list of offset,headword
15 Biobuf *bout = &boutbuf;
21 Dict *dict; /* current dictionary */
28 fprint(2, "usage: %s [-D] [-d dictname]\n", argv0);
33 main(int argc, char **argv)
40 Binit(&boutbuf, 1, OWRITE);
47 for(i=0; dicts[i].name; i++) {
48 if(strcmp(p, dicts[i].name)==0) {
54 err("unknown dictionary: %s", p);
65 bdict = Bopen(dict->path, OREAD);
67 err("can't open dictionary %s", dict->path);
70 ae = Bseek(bdict, 0, 2);
71 for(a = 0; a < ae; a = (*dict->nextoff)(a+1)) {
74 Bprint(bout, "%ld\t", a);
75 linelen = 4; /* only has to be approx right */
76 (*dict->printentry)(e, 'h');
86 static int anslen = 0;
88 e = (*dict->nextoff)(b+1);
91 dtop = Bseek(bdict, 0L, 2);
95 err("couldn't seek to entry");
103 if((ans.start = realloc(ans.start, n)) == nil)
104 sysfatal("realloc: %r");
108 n = Bread(bdict, ans.start, n);
109 ans.end = ans.start + n;