- eassert(!current->s[0]);
- strcpy(current->s, chrs);
- }
- eassert(!ferror(db));
- eassert(!fclose(db));
-}
-
-static void callout_unknown(OcrReader *rd, int w, Pixcol cols[],
- int unk_l, int unk_r, unsigned unk_ctxmap) {
- int jobpipe[2],donepipe[2], c, r,i, x,y;
- const OcrResultGlyph *s;
- const char *p;
- char cb;
- Pixcol pv;
-
- if (!resolver) {
- r= pipe(jobpipe); eassert(!r);
- r= pipe(donepipe); eassert(!r);
- resolver_pid= fork();
- eassert(resolver_pid!=-1);
- if (!resolver_pid) {
- r= dup2(jobpipe[0],0); eassert(r==0);
- r= close(jobpipe[1]); eassert(!r);
- r= close(donepipe[0]); eassert(!r);
- /* we know donepipe[1] is >= 4 and we have dealt with all the others
- * so we aren't in any danger of overwriting some other fd 4: */
- r= dup2(donepipe[1],4); eassert(r==4);
- execlp("./show-thing.tcl", "./show-thing.tcl",
- "--automatic","1",(char*)0);
- eassert(!"execlp failed");
+ if (!current->defined) {
+ free(current->str);
+ current->str= 0;
+ current->defined= 1;
+ current->match= 0;
+
+ if (nchrs) {
+ current->str= mmalloc(nchrs+1);
+ memcpy(current->str, chrs, nchrs);
+ current->str[nchrs]= 0;
+ current->match= 1;
+ current->endsword= endsword;
+ }