X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=dict%2Fscan.c;h=01be13e1af2c6c0ec6fe291182c722ed305a50d2;hb=d07818ca27f4e0efc9683148cb5d9891d34b9495;hp=13897dab75313e35eb785ffd67506f313075c717;hpb=29357d2be4bc20d412d38bcb29876daedda28637;p=idzebra-moved-to-github.git diff --git a/dict/scan.c b/dict/scan.c index 13897da..01be13e 100644 --- a/dict/scan.c +++ b/dict/scan.c @@ -4,7 +4,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: scan.c,v $ - * Revision 1.5 1995-10-09 16:18:32 adam + * Revision 1.7 1995-12-11 09:04:50 adam + * Bug fix: the lookup/scan/lookgrep didn't handle empty dictionary. + * + * Revision 1.6 1995/11/20 11:58:04 adam + * Support for YAZ in standard located directories, such as /usr/local/.. + * + * Revision 1.5 1995/10/09 16:18:32 adam * Function dict_lookup_grep got extra client data parameter. * * Revision 1.4 1995/10/06 13:52:00 adam @@ -103,6 +109,8 @@ int dict_scan_r (Dict dict, Dict_ptr ptr, int pos, Dict_char *str, char *info; dict_bf_readp (dict->dbf, ptr, &p); + if (!p) + return 0; mid = lo = 0; hi = DICT_nodir(p)-1; indxp = (short*) ((char*) p+DICT_pagesize(dict)-sizeof(short)); @@ -191,8 +199,8 @@ int dict_scan (Dict dict, Dict_char *str, int *before, int *after, int (*f)(Dict_char *name, const char *info, int pos, void *client)) { - int i; - i = dict_scan_r (dict, 1, 0, str, before, after, client, f); - return i; + if (dict->head.last <= 1) + return 0; + return dict_scan_r (dict, 1, 0, str, before, after, client, f); }