1 /* This file is part of the Zebra server.
2 Copyright (C) Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 static char *dict_look(Dict dict, const Dict_char *str, Dict_ptr ptr)
40 dict_bf_readp(dict->dbf, ptr, &p);
43 indxp = (short*) ((char*) p+DICT_bsize(p)-sizeof(short));
49 /* string (Dict_char *) DICT_EOS terminated */
50 /* unsigned char length of information */
51 /* char * information */
52 info = (char*)p + indxp[-mid];
53 cmp = dict_strcmp((Dict_char*) info, str);
55 return info+(dict_strlen ((Dict_char*) info)+1)
64 /* Dict_char sub char */
65 /* unsigned char length of information */
66 /* char * information */
67 info = (char*)p - indxp[-mid];
68 memcpy(&dc, info+sizeof(Dict_ptr), sizeof(Dict_char));
72 memcpy(&subptr, info, sizeof(Dict_ptr));
73 if (*++str == DICT_EOS)
75 if (info[sizeof(Dict_ptr)+sizeof(Dict_char)])
76 return info+sizeof(Dict_ptr)+sizeof(Dict_char);
84 dict_bf_readp(dict->dbf, ptr, &p);
87 indxp = (short*) ((char*) p+DICT_bsize(p)-sizeof(short));
100 char *dict_lookup(Dict dict, const char *p)
103 if (!dict->head.root)
105 return dict_look(dict, (const Dict_char *) p, dict->head.root);
110 * c-file-style: "Stroustrup"
111 * indent-tabs-mode: nil
113 * vim: shiftwidth=4 tabstop=8 expandtab