From 285a986588deacac089734552a7149142f7afc7d Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 14 Oct 1999 14:33:49 +0000 Subject: [PATCH] Added truncation 5=106. --- bfile/bfile.c | 10 +++++++++- bfile/mfile.c | 18 +++++++++++------- index/main.c | 10 +++++++++- index/zebraapi.c | 18 +++++++++++++++++- index/zrpn.c | 29 +++++++++++++++++++++++------ 5 files changed, 69 insertions(+), 16 deletions(-) diff --git a/bfile/bfile.c b/bfile/bfile.c index 91e8fe2..5ae3b3e 100644 --- a/bfile/bfile.c +++ b/bfile/bfile.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: bfile.c,v $ - * Revision 1.29 1999-05-26 07:49:12 adam + * Revision 1.30 1999-10-14 14:33:49 adam + * Added truncation 5=106. + * + * Revision 1.29 1999/05/26 07:49:12 adam * C++ compilation. * * Revision 1.28 1999/05/12 13:08:05 adam @@ -119,6 +122,11 @@ BFiles bfs_create (const char *spec) bfs->commit_area = NULL; bfs->register_area = mf_init("register", spec); bfs->lockDir = NULL; + if (!bfs->register_area) + { + bfs_destroy(bfs); + return 0; + } return bfs; } diff --git a/bfile/mfile.c b/bfile/mfile.c index 6b7be96..9722fe5 100644 --- a/bfile/mfile.c +++ b/bfile/mfile.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: mfile.c,v $ - * Revision 1.34 1999-05-26 07:49:12 adam + * Revision 1.35 1999-10-14 14:33:50 adam + * Added truncation 5=106. + * + * Revision 1.34 1999/05/26 07:49:12 adam * C++ compilation. * * Revision 1.33 1999/05/12 13:08:06 adam @@ -164,12 +167,12 @@ static int scan_areadef(MFile_area ma, const char *name, const char *ad) dirname[i] = '\0'; if (*ad++ != ':') { - logf (LOG_FATAL, "Missing colon after path: %s", ad0); + logf (LOG_WARN, "Missing colon after path: %s", ad0); return -1; } if (i == 0) { - logf (LOG_FATAL, "Empty path: %s", ad0); + logf (LOG_WARN, "Empty path: %s", ad0); return -1; } while (*ad == ' ' || *ad == '\t') @@ -234,13 +237,13 @@ static int file_position(MFile mf, int pos, int offset) { if (!mf->wr && errno == ENOENT && off == 0) return -2; - logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", mf->files[c].path); + logf (LOG_WARN|LOG_ERRNO, "Failed to open %s", mf->files[c].path); return -1; } if (lseek(mf->files[c].fd, (ps = pos - off) * mf->blocksize + offset, SEEK_SET) < 0) { - logf (LOG_FATAL|LOG_ERRNO, "Failed to seek in %s", mf->files[c].path); + logf (LOG_WARN|LOG_ERRNO, "Failed to seek in %s", mf->files[c].path); return -1; } mf->cur_file = c; @@ -273,7 +276,7 @@ MFile_area mf_init(const char *name, const char *spec) ma->dirs = 0; if (scan_areadef(ma, name, spec) < 0) { - logf (LOG_FATAL, "Failed to access description of '%s'", name); + logf (LOG_WARN, "Failed to access description of '%s'", name); return 0; } /* look at each directory */ @@ -281,7 +284,8 @@ MFile_area mf_init(const char *name, const char *spec) { if (!(dd = opendir(dirp->name))) { - logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", dirp->name); + logf (LOG_WARN|LOG_ERRNO, "Failed to open directory %s", + dirp->name); return 0; } /* look at each file */ diff --git a/index/main.c b/index/main.c index e7b0d31..4ab1ebf 100644 --- a/index/main.c +++ b/index/main.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: main.c,v $ - * Revision 1.71 1999-09-08 12:12:06 adam + * Revision 1.72 1999-10-14 14:33:50 adam + * Added truncation 5=106. + * + * Revision 1.71 1999/09/08 12:12:06 adam * Fixed bad message. * * Revision 1.70 1999/09/07 07:19:21 adam @@ -372,6 +375,11 @@ int main (int argc, char **argv) rGroupDef.bfs = bfs_create (res_get (common_resource, "register")); + if (!rGroupDef.bfs) + { + logf (LOG_FATAL, "Cannot access register"); + exit(1); + } bf_lockDir (rGroupDef.bfs, res_get (common_resource, "lockDir")); diff --git a/index/zebraapi.c b/index/zebraapi.c index c37df05..3400ea9 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zebraapi.c,v $ - * Revision 1.23 1999-09-07 11:36:32 adam + * Revision 1.24 1999-10-14 14:33:50 adam + * Added truncation 5=106. + * + * Revision 1.23 1999/09/07 11:36:32 adam * Minor changes. * * Revision 1.22 1999/08/02 10:13:47 adam @@ -275,7 +278,20 @@ ZebraHandle zebra_open (const char *configName) zebra_chdir (zh); zebra_server_lock_init (zh); zh->dh = data1_create (); + if (!zh->dh) + { + zebra_server_lock_destroy (zh); + xfree (zh); + return 0; + } zh->bfs = bfs_create (res_get (zh->res, "register")); + if (!zh->bfs) + { + zebra_server_lock_destroy (zh); + data1_destroy(zh->dh); + xfree (zh); + return 0; + } bf_lockDir (zh->bfs, res_get (zh->res, "lockDir")); data1_set_tabpath (zh->dh, res_get(zh->res, "profilePath")); zh->sets = NULL; diff --git a/index/zrpn.c b/index/zrpn.c index 14e17ea..30b7b30 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.96 1999-09-23 10:05:05 adam + * Revision 1.97 1999-10-14 14:33:50 adam + * Added truncation 5=106. + * + * Revision 1.96 1999/09/23 10:05:05 adam * Implemented structure=105 searching. * * Revision 1.95 1999/09/07 07:19:21 adam @@ -717,10 +720,10 @@ static int term_104 (ZebraMaps zebra_maps, int reg_type, return i; } -/* term_105: handle term, where trunc=Process # and ! and right trunc */ +/* term_105/106: handle term, where trunc=Process # and ! and right trunc */ static int term_105 (ZebraMaps zebra_maps, int reg_type, const char **src, char *dst, int space_split, - char *dst_term) + char *dst_term, int right_truncate) { const char *s0, *s1; const char **map; @@ -757,8 +760,11 @@ static int term_105 (ZebraMaps zebra_maps, int reg_type, } } } - dst[i++] = '.'; - dst[i++] = '*'; + if (right_truncate) + { + dst[i++] = '.'; + dst[i++] = '*'; + } dst[i] = '\0'; dst_term[j++] = '\0'; @@ -1253,7 +1259,18 @@ static int string_term (ZebraHandle zh, Z_AttributesPlusTerm *zapt, case 105: /* process * and ! in term */ term_dict[j++] = '('; if (!term_105 (zh->zebra_maps, reg_type, - &termp, term_dict + j, space_split, term_dst)) + &termp, term_dict + j, space_split, term_dst, 1)) + return 0; + strcat (term_dict, ")"); + r = dict_lookup_grep (zh->dict, term_dict, 0, grep_info, + &max_pos, 0, grep_handle); + if (r) + logf (LOG_WARN, "dict_lookup_grep err, trunc=*/!: %d", r); + break; + case 106: /* process * and ! in term */ + term_dict[j++] = '('; + if (!term_105 (zh->zebra_maps, reg_type, + &termp, term_dict + j, space_split, term_dst, 0)) return 0; strcat (term_dict, ")"); r = dict_lookup_grep (zh->dict, term_dict, 0, grep_info, -- 1.7.10.4