From: Adam Dickmeiss Date: Tue, 5 Dec 2006 09:26:37 +0000 (+0000) Subject: Provide defaults for profilePath and modulePath for the zebra{srv,idx}. X-Git-Tag: ZEBRA.2.0.8~56 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=4c112f15503aebed494fab8aa5296c3661bfb31c Provide defaults for profilePath and modulePath for the zebra{srv,idx}. --- diff --git a/index/Makefile.am b/index/Makefile.am index 5f7907f..4aacf7b 100644 --- a/index/Makefile.am +++ b/index/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.59 2006-11-21 14:32:38 adam Exp $ +## $Id: Makefile.am,v 1.60 2006-12-05 09:26:37 adam Exp $ aux_libs = \ ../rset/libidzebra-rset.la \ @@ -99,6 +99,7 @@ kdump_SOURCES = kdump.c AM_CPPFLAGS = -I$(srcdir)/../include $(YAZINC) \ -DDEFAULT_PROFILE_PATH=\"$(pkgdatadir)/tab\" \ + -DDEFAULT_MODULE_PATH=\"$(modlibdir)\" \ $(TCL_INCLUDE) LDADD = $(zebralib) $(YAZLALIB) diff --git a/index/zebraapi.c b/index/zebraapi.c index 709e291..3f80807 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.235 2006-11-27 09:17:01 adam Exp $ +/* $Id: zebraapi.c,v 1.236 2006-12-05 09:26:37 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -174,12 +174,12 @@ ZebraHandle zebra_open(ZebraService zs, Res res) return zh; } -ZebraService zebra_start (const char *configName) +ZebraService zebra_start(const char *configName) { return zebra_start_res(configName, 0, 0); } -ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) +ZebraService zebra_start_res(const char *configName, Res def_res, Res over_res) { Res res; @@ -348,8 +348,7 @@ struct zebra_register *zebra_register_open(ZebraService zs, const char *name, } getcwd(cwd, sizeof(cwd)-1); - profilePath = res_get_def(res, "profilePath", DEFAULT_PROFILE_PATH); - yaz_log(YLOG_DEBUG, "profilePath=%s cwd=%s", profilePath, cwd); + profilePath = res_get_def(res, "profilePath", 0); data1_set_tabpath (reg->dh, profilePath); data1_set_tabroot (reg->dh, reg_path); diff --git a/index/zebraidx.c b/index/zebraidx.c index d07d76f..4fe0448 100644 --- a/index/zebraidx.c +++ b/index/zebraidx.c @@ -1,4 +1,4 @@ -/* $Id: zebraidx.c,v 1.1 2006-09-22 10:18:08 adam Exp $ +/* $Id: zebraidx.c,v 1.2 2006-12-05 09:26:37 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -64,6 +64,7 @@ int main (int argc, char **argv) int enable_commit = 1; char *database = 0; Res res = res_open(0, 0); + Res default_res = res_open(0, 0); int trans_started=0; #if HAVE_SYS_TIMES_H @@ -120,6 +121,8 @@ int main (int argc, char **argv) ); exit (1); } + res_set(default_res, "profilePath", DEFAULT_PROFILE_PATH); + res_set(default_res, "modulePath", DEFAULT_MODULE_PATH); while ((ret = options("sVt:c:g:d:m:v:nf:l:L", argv, argc, &arg)) != -2) { if (ret == 0) @@ -129,7 +132,7 @@ int main (int argc, char **argv) if (!zs) { const char *config = configName ? configName : "zebra.cfg"; - zs = zebra_start_res (config, 0, res); + zs = zebra_start_res(config, default_res, res); if (!zs) { yaz_log (YLOG_FATAL, "Cannot read config %s", config); @@ -309,6 +312,8 @@ int main (int argc, char **argv) } #endif #endif + res_close(res); + res_close(default_res); nmem_exit(); exit (0); return 0; diff --git a/index/zebrasrv.c b/index/zebrasrv.c index 966c186..613febb 100644 --- a/index/zebrasrv.c +++ b/index/zebrasrv.c @@ -1,4 +1,4 @@ -/* $Id: zebrasrv.c,v 1.2 2006-11-21 22:17:49 adam Exp $ +/* $Id: zebrasrv.c,v 1.3 2006-12-05 09:26:37 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -756,9 +756,14 @@ int bend_esrequest (void *handle, bend_esrequest_rr *rr) static void bend_start (struct statserv_options_block *sob) { + Res default_res = res_open(0, 0); + if (sob->handle) zebra_stop((ZebraService) sob->handle); + res_set(default_res, "profilePath", DEFAULT_PROFILE_PATH); + res_set(default_res, "modulePath", DEFAULT_MODULE_PATH); sob->handle = zebra_start(sob->configname); + res_close(default_res); if (!sob->handle) { yaz_log (YLOG_FATAL, "Failed to read config `%s'", sob->configname);