X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=index%2Fzserver.c;h=88a90a4bde360f45cb9f0b5a592ba4f2d98844d6;hb=adc0ef50c52d332902ef92c8feb460eee55a1f05;hp=f9f58231fdebaba2544b4e3016fb617d075a45a6;hpb=62f6cad37f14a19d9c1ce763ea54a61b350c7881;p=idzebra-moved-to-github.git diff --git a/index/zserver.c b/index/zserver.c index f9f5823..88a90a4 100644 --- a/index/zserver.c +++ b/index/zserver.c @@ -4,7 +4,19 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zserver.c,v $ - * Revision 1.32 1995-12-11 09:12:58 adam + * Revision 1.35 1996-03-26 16:01:14 adam + * New setting lockPath: directory of various lock files. + * + * Revision 1.34 1996/03/20 09:36:46 adam + * Function dict_lookup_grep got extra parameter, init_pos, which marks + * from which position in pattern approximate pattern matching should occur. + * Approximate pattern matching is used in relevance=re-2. + * + * Revision 1.33 1996/01/17 14:57:56 adam + * Prototype changed for reader functions in extract/retrieve. File + * is identified by 'void *' instead of 'int. + * + * Revision 1.32 1995/12/11 09:12:58 adam * The rec_get function returns NULL if record doesn't exist - will * happen in the server if the result set records have been deleted since * the creation of the set (i.e. the search). @@ -215,8 +227,9 @@ bend_initresult *bend_init (bend_initrequest *q) logf (LOG_FATAL, "Cannot open resource `%s'", sob->configname); exit (1); } + bf_lockDir (res_get (common_resource, "lockPath")); + data1_tabpath = res_get(common_resource, "profilePath"); } - data1_tabpath = res_get(common_resource, "profilePath"); server_info.sets = NULL; server_info.registerState = -1; /* trigger open of registers! */ server_info.registerChange = 0; @@ -257,16 +270,16 @@ bend_searchresult *bend_search (void *handle, bend_searchrequest *q, int *fd) return &r; } -static int record_ext_read (int fd, char *buf, size_t count) +static int record_ext_read (void *fh, char *buf, size_t count) { - return read (fd, buf, count); + return read (*((int*) fh), buf, count); } static int record_int_pos; static char *record_int_buf; static int record_int_len; -static int record_int_read (int fd, char *buf, size_t count) +static int record_int_read (void *fh, char *buf, size_t count) { int l = record_int_len - record_int_pos; if (l <= 0) @@ -285,6 +298,7 @@ static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream, Record rec; char *fname, *file_type; RecType rt; + int fd = -1; struct recRetrieveCtrl retrieveCtrl; char subType[128]; @@ -295,6 +309,7 @@ static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream, *output_format = VAL_SUTRS; *rec_bufp = msg; *rec_lenp = strlen (msg); + logf (LOG_DEBUG, "rec_get fail on sysno=%d", sysno); return 0; } file_type = rec->info[recInfo_fileType]; @@ -317,7 +332,7 @@ static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream, } else { - if ((retrieveCtrl.fd = open (fname, O_RDONLY)) == -1) + if ((fd = open (fname, O_RDONLY)) == -1) { char *msg = "Record doesn't exist\n"; logf (LOG_WARN|LOG_ERRNO, "Retrieve: Open record file %s", fname); @@ -327,6 +342,7 @@ static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream, rec_rm (&rec); return 0; /* or 14: System error in presenting records */ } + retrieveCtrl.fh = &fd; retrieveCtrl.readf = record_ext_read; } retrieveCtrl.subType = subType; @@ -340,7 +356,8 @@ static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream, *output_format = retrieveCtrl.output_format; *rec_bufp = retrieveCtrl.rec_buf; *rec_lenp = retrieveCtrl.rec_len; - close (retrieveCtrl.fd); + if (fd != -1) + close (fd); rec_rm (&rec); return retrieveCtrl.diagnostic;