// edit hash tables void edhash(char *input) { // read in hash tables readhash(input); // review or update edithash(input); return; }
Biobuf * prepare(int i, char *arg) { struct line *p; int j, h; Biobuf *bp; char *cp, buf[MAXLINELEN]; int nbytes; Rune r; bp = Bopen(arg, OREAD); if (!bp) { panic(mflag ? 0: 2, "cannot open %s: %r\n", arg); return 0; } if (binary) return bp; nbytes = Bread(bp, buf, MIN(1024, MAXLINELEN)); if (nbytes > 0) { cp = buf; while (cp < buf+nbytes-UTFmax) { /* * heuristic for a binary file in the * brave new UNICODE world */ cp += chartorune(&r, cp); if (r == 0 || (r > 0x7f && r <= 0xa0)) { binary++; return bp; } } Bseek(bp, 0, 0); } p = MALLOC(struct line, 3); for (j = 0; h = readhash(bp, buf); p[j].value = h) p = REALLOC(p, struct line, (++j+3)); len[i] = j; file[i] = p; input[i] = bp; /*fix*/ if (i == 0) { /*fix*/ file1 = arg; firstchange = 0; } else file2 = arg; return bp; }