#include "pazpar2_config.h"
#include "settings.h"
-static char confdir[256] = ".";
+static WRBUF confdir = 0;
static char *parse_settings(NMEM nmem, xmlNode *node);
else
{
r = nmem_malloc(nmem,
- strlen(confdir) + strlen((const char *) src) + 2);
- sprintf(r, "%s/%s", confdir, src);
+ wrbuf_len(confdir) + strlen((const char *) src) + 2);
+ sprintf(r, "%s/%s", wrbuf_cstr(confdir), src);
}
}
else
server->proxy_host = 0;
server->proxy_port = 0;
server->myurl = 0;
+ server->proxy_addr = 0;
server->service = 0;
server->next = 0;
server->server_settings = 0;
}
else if (!strcmp((const char *) n->name, "service"))
{
- const char *service_id = (const char *)
+ char *service_id = (char *)
xmlGetProp(n, (xmlChar *) "id");
struct conf_service **sp = &server->service;
*sp = s;
}
}
+ xmlFree(service_id);
}
else
{
if (yaz_is_abspath(fname))
yaz_snprintf(path, sizeof(path), fname);
else
- yaz_snprintf(path, sizeof(path), "%s/%s", confdir, fname);
+ yaz_snprintf(path, sizeof(path), "%s/%s", wrbuf_cstr(confdir), fname);
return xsltParseStylesheetFile((xmlChar *) path);
}
yaz_log(YLOG_FATAL, "Failed to read %s", fname);
exit(1);
}
+ confdir = wrbuf_alloc();
if ((p = strrchr(fname,
#ifdef WIN32
'\\'
)))
{
int len = p - fname;
- if (len >= sizeof(confdir))
- len = sizeof(confdir)-1;
- strncpy(confdir, fname, len);
- confdir[len] = '\0';
+ wrbuf_write(confdir, fname, len);
}
+ wrbuf_puts(confdir, "");
config = parse_config(xmlDocGetRootElement(doc));
xmlFreeDoc(doc);