2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1995-12-07 11:48:55 adam
8 * Insert operation obeys DICT_type = 1 (slack in page).
9 * Function dict_open exists if page size or magic aren't right.
11 * Revision 1.2 1995/12/06 17:48:30 adam
12 * Bug fix: delete didn't work.
14 * Revision 1.1 1995/12/06 14:52:21 adam
15 * New function: dict_delete.
26 static int dict_del (Dict dict, const Dict_char *str)
35 dict_bf_readp (dict->dbf, ptr, &p);
38 indxp = (short*) ((char*) p+DICT_pagesize(dict)-sizeof(short));
44 /* string (Dict_char *) DICT_EOS terminated */
45 /* unsigned char length of information */
46 /* char * information */
47 info = (char*)p + indxp[-mid];
48 cmp = dict_strcmp((Dict_char*) info, str);
54 indxp[-mid] = indxp[-mid-1];
59 dict_bf_touch (dict->dbf, ptr);
69 /* Dict_char sub char */
70 /* unsigned char length of information */
71 /* char * information */
72 info = (char*)p - indxp[-mid];
73 memcpy (&dc, info+sizeof(Dict_ptr), sizeof(Dict_char));
77 memcpy (&subptr, info, sizeof(Dict_ptr));
78 if (*++str == DICT_EOS)
80 if (info[sizeof(Dict_ptr)+sizeof(Dict_char)])
82 info[sizeof(Dict_ptr)+sizeof(Dict_char)] = 0;
84 dict_bf_touch (dict->dbf, ptr);
94 dict_bf_readp (dict->dbf, ptr, &p);
97 indxp = (short*) ((char*) p+DICT_pagesize(dict)
111 int dict_delete (Dict dict, const Dict_char *p)
113 if (dict->head.last == 1)
115 return dict_del (dict, p);