X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Fsafari.c;h=432b2dcd6c8072db28764786754b179e09a69410;hb=ecb3935e78cd9bcfdebafdee0834cfb1060d7b5e;hp=c524599b3cac9002bba1620e3e808d3dfa56cd56;hpb=3c4d4c20c0735741737e66cf8d270a87fa7eb58e;p=idzebra-moved-to-github.git diff --git a/recctrl/safari.c b/recctrl/safari.c index c524599..432b2dc 100644 --- a/recctrl/safari.c +++ b/recctrl/safari.c @@ -1,4 +1,4 @@ -/* $Id: safari.c,v 1.7 2005-03-31 12:42:07 adam Exp $ +/* $Id: safari.c,v 1.12 2006-05-10 08:13:31 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -39,9 +39,9 @@ static void *filter_init (Res res, RecType recType) return tinfo; } -static void filter_config(void *clientData, Res res, const char *args) +static ZEBRA_RES filter_config(void *clientData, Res res, const char *args) { - + return ZEBRA_OK; } static void filter_destroy(void *clientData) @@ -86,13 +86,16 @@ static int fi_getchar(struct fi_info *fi, char *dst) static int fi_gets(struct fi_info *fi, char *dst, int max) { - int l; - for (l = 0; l < max; l++) + int l = 0; + while(1) { - if (!fi_getchar(fi, dst+l)) + char dstbyte; + if (!fi_getchar(fi, &dstbyte)) return 0; - if (dst[l] == '\n') + if (dstbyte == '\n') break; + if (l < max) + dst[l++] = dstbyte; } dst[l] = '\0'; return 1; @@ -123,7 +126,7 @@ static int filter_extract(void *clientData, struct recExtractCtrl *p) return RECCTRL_EXTRACT_ERROR_GENERIC; sscanf(line, "%255s", p->match_criteria); - recWord.reg_type = 'w'; + recWord.index_type = '0'; while (fi_gets(fi, line, sizeof(line)-1)) { int nor = 0; @@ -141,7 +144,7 @@ static int filter_extract(void *clientData, struct recExtractCtrl *p) } for (cp = line + nor; *cp == ' '; cp++) ; - recWord.attrStr = field; + recWord.index_name = field; recWord.term_buf = cp; recWord.term_len = strlen(cp); (*p->tokenAdd)(&recWord); @@ -266,3 +269,11 @@ idzebra_filter &filter_type, 0, }; +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +