Blob
1 #include <u.h>2 #include <libc.h>3 #include <bio.h>4 #include "dict.h"6 /*7 * Routines for handling dictionaries in UTF, headword8 * separated from entry by tab, entries separated by newline.9 */11 void12 simpleprintentry(Entry e, int cmd)13 {14 uchar *p, *pe;16 p = (uchar *)e.start;17 pe = (uchar *)e.end;18 while(p < pe){19 if(*p == '\t'){20 if(cmd == 'h')21 break;22 else23 outchar(' '), ++p;24 }else if(*p == '\n')25 break;26 else27 outchar(*p++);28 }29 outnl(0);30 }32 long33 simplenextoff(long fromoff)34 {35 if(Bseek(bdict, fromoff, 0) < 0)36 return -1;37 if(Brdline(bdict, '\n') == 0)38 return -1;39 return Boffset(bdict);40 }42 void43 simpleprintkey(void)44 {45 Bprint(bout, "No pronunciation key.\n");46 }