projects
/
idzebra-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
262720e
)
Added parameter for zebra_open.
author
Adam Dickmeiss
<adam@indexdata.dk>
Tue, 13 Sep 2005 11:51:05 +0000
(11:51 +0000)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Tue, 13 Sep 2005 11:51:05 +0000
(11:51 +0000)
47 files changed:
dict/dicttest.c
patch
|
blob
|
history
include/idzebra/api.h
patch
|
blob
|
history
include/idzebra/res.h
patch
|
blob
|
history
index/apitest.c
patch
|
blob
|
history
index/index.h
patch
|
blob
|
history
index/main.c
patch
|
blob
|
history
index/zebraapi.c
patch
|
blob
|
history
index/zebrash.c
patch
|
blob
|
history
index/zserver.c
patch
|
blob
|
history
test/api/safari1.c
patch
|
blob
|
history
test/api/t1.c
patch
|
blob
|
history
test/api/t10.c
patch
|
blob
|
history
test/api/t11.c
patch
|
blob
|
history
test/api/t12.c
patch
|
blob
|
history
test/api/t13.c
patch
|
blob
|
history
test/api/t2.c
patch
|
blob
|
history
test/api/t3.c
patch
|
blob
|
history
test/api/t4.c
patch
|
blob
|
history
test/api/t5.c
patch
|
blob
|
history
test/api/t6.c
patch
|
blob
|
history
test/api/t7.c
patch
|
blob
|
history
test/api/t8.c
patch
|
blob
|
history
test/api/t9.c
patch
|
blob
|
history
test/api/testlib.c
patch
|
blob
|
history
test/api/testlib.h
patch
|
blob
|
history
test/charmap/charmap1.c
patch
|
blob
|
history
test/espec/t1.c
patch
|
blob
|
history
test/filters/grs.marc.c
patch
|
blob
|
history
test/filters/grs.xml.c
patch
|
blob
|
history
test/filters/text.c
patch
|
blob
|
history
test/marcxml/t1.c
patch
|
blob
|
history
test/marcxml/t2.c
patch
|
blob
|
history
test/mbox/mbox1.c
patch
|
blob
|
history
test/rusmarc/t1.c
patch
|
blob
|
history
test/sort/sort1.c
patch
|
blob
|
history
test/sort2/t1.c
patch
|
blob
|
history
test/xpath/xpath1.c
patch
|
blob
|
history
test/xpath/xpath2.c
patch
|
blob
|
history
test/xpath/xpath3.c
patch
|
blob
|
history
test/xpath/xpath4.c
patch
|
blob
|
history
test/xpath/xpath5.c
patch
|
blob
|
history
test/xpath/xpath6.c
patch
|
blob
|
history
test/xslt/xslt1.c
patch
|
blob
|
history
test/xslt/xslt2.c
patch
|
blob
|
history
test/xslt/xslt3.c
patch
|
blob
|
history
test/xslt/xslt4.c
patch
|
blob
|
history
util/res.c
patch
|
blob
|
history
diff --git
a/dict/dicttest.c
b/dict/dicttest.c
index
053d586
..
331f5f5
100644
(file)
--- a/
dict/dicttest.c
+++ b/
dict/dicttest.c
@@
-1,4
+1,4
@@
-/* $Id: dicttest.c,v 1.34 2005-04-15 10:47:48 adam Exp $
+/* $Id: dicttest.c,v 1.35 2005-09-13 11:51:05 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-160,12
+160,14
@@
int main (int argc, char **argv)
yaz_log (YLOG_FATAL, "no config and/or dictionary specified");
exit (1);
}
yaz_log (YLOG_FATAL, "no config and/or dictionary specified");
exit (1);
}
- my_resource = res_open (config, 0, 0);
+ my_resource = res_open(0, 0);
if (!my_resource)
{
yaz_log (YLOG_FATAL, "cannot open resource `%s'", config);
exit (1);
}
if (!my_resource)
{
yaz_log (YLOG_FATAL, "cannot open resource `%s'", config);
exit (1);
}
+ res_read_file(my_resource, config);
+
bfs = bfs_create (res_get(my_resource, "register"), 0);
if (!bfs)
{
bfs = bfs_create (res_get(my_resource, "register"), 0);
if (!bfs)
{
diff --git
a/include/idzebra/api.h
b/include/idzebra/api.h
index
cf6c387
..
c505c90
100644
(file)
--- a/
include/idzebra/api.h
+++ b/
include/idzebra/api.h
@@
-1,4
+1,4
@@
-/* $Id: api.h,v 1.29 2005-08-09 10:01:03 adam Exp $
+/* $Id: api.h,v 1.30 2005-09-13 11:51:05 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-129,7
+129,7
@@
void zebra_filter_info(ZebraService zs, void *cd,
one handle is sufficient
*/
YAZ_EXPORT
one handle is sufficient
*/
YAZ_EXPORT
-ZebraHandle zebra_open(ZebraService zs);
+ZebraHandle zebra_open(ZebraService zs, Res res);
/**
\brief Destroys Zebra session handle.
/**
\brief Destroys Zebra session handle.
diff --git
a/include/idzebra/res.h
b/include/idzebra/res.h
index
8c68715
..
68e2c90
100644
(file)
--- a/
include/idzebra/res.h
+++ b/
include/idzebra/res.h
@@
-1,4
+1,4
@@
-/* $Id: res.h,v 1.6 2005-08-17 21:28:07 adam Exp $
+/* $Id: res.h,v 1.7 2005-09-13 11:51:06 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-30,36
+30,39
@@
YAZ_BEGIN_CDECL
typedef struct res_struct *Res;
YAZ_EXPORT
typedef struct res_struct *Res;
YAZ_EXPORT
-Res res_open (const char *name, Res res_def, Res over_res);
+Res res_open(Res res_def, Res over_res);
YAZ_EXPORT
YAZ_EXPORT
-void res_close (Res r);
+void res_close(Res r);
YAZ_EXPORT
YAZ_EXPORT
-void res_clear (Res r);
+ZEBRA_RES res_read_file(Res r, const char *fname);
YAZ_EXPORT
YAZ_EXPORT
-const char *res_get (Res r, const char *name);
+ZEBRA_RES res_write_file(Res r, const char *fname);
YAZ_EXPORT
YAZ_EXPORT
-const char *res_get_def (Res r, const char *name, const char *def);
+void res_clear(Res r);
YAZ_EXPORT
YAZ_EXPORT
-int res_get_match (Res r, const char *name, const char *value, const char *s);
+const char *res_get(Res r, const char *name);
YAZ_EXPORT
YAZ_EXPORT
-void res_set (Res r, const char *name, const char *value);
+const char *res_get_def(Res r, const char *name, const char *def);
YAZ_EXPORT
YAZ_EXPORT
-int res_trav (Res r, const char *prefix, void *p,
- void (*f)(void *p, const char *name, const char *value));
+int res_get_match(Res r, const char *name, const char *value, const char *s);
+
+YAZ_EXPORT
+void res_set(Res r, const char *name, const char *value);
YAZ_EXPORT
YAZ_EXPORT
-int res_write (Res r);
+int res_trav(Res r, const char *prefix, void *p,
+ void (*f)(void *p, const char *name, const char *value));
YAZ_EXPORT
YAZ_EXPORT
-const char *res_get_prefix (Res r, const char *name, const char *prefix,
- const char *def);
+const char *res_get_prefix(Res r, const char *name, const char *prefix,
+ const char *def);
YAZ_EXPORT
ZEBRA_RES res_get_int(Res r, const char *name, int *val);
YAZ_EXPORT
ZEBRA_RES res_get_int(Res r, const char *name, int *val);
diff --git
a/index/apitest.c
b/index/apitest.c
index
cd88853
..
0248f72
100644
(file)
--- a/
index/apitest.c
+++ b/
index/apitest.c
@@
-1,4
+1,4
@@
-/* $Id: apitest.c,v 1.22 2005-03-09 12:14:42 adam Exp $
+/* $Id: apitest.c,v 1.23 2005-09-13 11:51:06 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-146,7
+146,7
@@
int main (int argc, char **argv)
exit (1);
}
/* open Zebra */
exit (1);
}
/* open Zebra */
- zh = zebra_open (zs);
+ zh = zebra_open (zs, 0);
if (!zh)
{
printf ("zebras_open failed\n");
if (!zh)
{
printf ("zebras_open failed\n");
diff --git
a/index/index.h
b/index/index.h
index
e9c8f50
..
b1f5c48
100644
(file)
--- a/
index/index.h
+++ b/
index/index.h
@@
-1,4
+1,4
@@
-/* $Id: index.h,v 1.149 2005-08-19 11:04:23 adam Exp $
+/* $Id: index.h,v 1.150 2005-09-13 11:51:06 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-282,6
+282,7
@@
struct zebra_session {
int destroyed;
ZebraSet sets;
Res res;
int destroyed;
ZebraSet sets;
Res res;
+ Res session_res;
char *user_perm;
int errCode;
zint hits;
char *user_perm;
int errCode;
zint hits;
diff --git
a/index/main.c
b/index/main.c
index
c1709bc
..
1ced237
100644
(file)
--- a/
index/main.c
+++ b/
index/main.c
@@
-1,4
+1,4
@@
-/* $Id: main.c,v 1.126 2005-08-26 10:11:49 adam Exp $
+/* $Id: main.c,v 1.127 2005-09-13 11:51:06 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-63,7
+63,7
@@
int main (int argc, char **argv)
int nsections = 0;
int enable_commit = 1;
char *database = 0;
int nsections = 0;
int enable_commit = 1;
char *database = 0;
- Res res = res_open(0, 0, 0);
+ Res res = res_open(0, 0);
int trans_started=0;
#if HAVE_SYS_TIMES_H
int trans_started=0;
#if HAVE_SYS_TIMES_H
@@
-135,7
+135,7
@@
int main (int argc, char **argv)
yaz_log (YLOG_FATAL, "Cannot read config %s", config);
exit (1);
}
yaz_log (YLOG_FATAL, "Cannot read config %s", config);
exit (1);
}
- zh = zebra_open (zs);
+ zh = zebra_open (zs, 0);
zebra_shadow_enable (zh, enable_commit);
}
zebra_shadow_enable (zh, enable_commit);
}
diff --git
a/index/zebraapi.c
b/index/zebraapi.c
index
40aa1cc
..
2ffaed2
100644
(file)
--- a/
index/zebraapi.c
+++ b/
index/zebraapi.c
@@
-1,4
+1,4
@@
-/* $Id: zebraapi.c,v 1.184 2005-08-22 09:04:18 adam Exp $
+/* $Id: zebraapi.c,v 1.185 2005-09-13 11:51:06 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-49,8
+49,8
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static int log_level = 0;
static int log_level_initialized = 0;
static int log_level = 0;
static int log_level_initialized = 0;
-static Res zebra_open_res (ZebraHandle zh);
-static void zebra_close_res (ZebraHandle zh);
+static void zebra_open_res(ZebraHandle zh);
+static void zebra_close_res(ZebraHandle zh);
static void zebra_chdir (ZebraService zs)
{
static void zebra_chdir (ZebraService zs)
{
@@
-79,14
+79,14
@@
static void zebra_flush_reg (ZebraHandle zh)
zebra_index_merge (zh );
}
zebra_index_merge (zh );
}
-static struct zebra_register *zebra_register_open (ZebraService zs,
- const char *name,
- int rw, int useshadow,
- Res res,
- const char *reg_path);
+static struct zebra_register *zebra_register_open(ZebraService zs,
+ const char *name,
+ int rw, int useshadow,
+ Res res,
+ const char *reg_path);
static void zebra_register_close (ZebraService zs, struct zebra_register *reg);
static void zebra_register_close (ZebraService zs, struct zebra_register *reg);
-ZebraHandle zebra_open (ZebraService zs)
+ZebraHandle zebra_open(ZebraService zs, Res res)
{
ZebraHandle zh;
const char *default_encoding;
{
ZebraHandle zh;
const char *default_encoding;
@@
-111,6
+111,7
@@
ZebraHandle zebra_open (ZebraService zs)
zh->errCode = 0;
zh->errString = 0;
zh->res = 0;
zh->errCode = 0;
zh->errString = 0;
zh->res = 0;
+ zh->session_res = res_open(zs->global_res, res);
zh->user_perm = 0;
zh->reg_name = xstrdup ("");
zh->user_perm = 0;
zh->reg_name = xstrdup ("");
@@
-128,7
+129,7
@@
ZebraHandle zebra_open (ZebraService zs)
zh->shadow_enable = 1;
zh->m_staticrank = 0;
zh->shadow_enable = 1;
zh->m_staticrank = 0;
- default_encoding = res_get_def(zs->global_res, "encoding", "ISO-8859-1");
+ default_encoding = res_get_def(zh->session_res, "encoding", "ISO-8859-1");
zh->iconv_to_utf8 =
yaz_iconv_open ("UTF-8", default_encoding);
zh->iconv_to_utf8 =
yaz_iconv_open ("UTF-8", default_encoding);
@@
-177,12
+178,15
@@
ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res)
yaz_log(YLOG_LOG, "zebra_start %s %s", ZEBRAVER,
configName ? configName : "");
yaz_log(YLOG_LOG, "zebra_start %s %s", ZEBRAVER,
configName ? configName : "");
- if ((res = res_open (configName, def_res, over_res)))
+ if ((res = res_open(def_res, over_res)))
{
const char *passwd_plain = 0;
const char *passwd_encrypt = 0;
ZebraService zh = xmalloc(sizeof(*zh));
{
const char *passwd_plain = 0;
const char *passwd_encrypt = 0;
ZebraService zh = xmalloc(sizeof(*zh));
+ if (configName)
+ res_read_file(res, configName);
+
zh->global_res = res;
zh->sessions = 0;
zh->global_res = res;
zh->sessions = 0;
@@
-246,9
+250,9
@@
Dict dict_open_res (BFiles bfs, const char *name, int cache, int rw,
}
static
}
static
-struct zebra_register *zebra_register_open (ZebraService zs, const char *name,
- int rw, int useshadow, Res res,
- const char *reg_path)
+struct zebra_register *zebra_register_open(ZebraService zs, const char *name,
+ int rw, int useshadow, Res res,
+ const char *reg_path)
{
struct zebra_register *reg;
int record_compression = REC_COMPRESS_NONE;
{
struct zebra_register *reg;
int record_compression = REC_COMPRESS_NONE;
@@
-533,6
+537,7
@@
ZEBRA_RES zebra_close (ZebraHandle zh)
if (zh->reg)
zebra_register_close (zh->service, zh->reg);
zebra_close_res (zh);
if (zh->reg)
zebra_register_close (zh->service, zh->reg);
zebra_close_res (zh);
+ res_close(zh->session_res);
xfree(zh->record_encoding);
xfree(zh->record_encoding);
@@
-583,38
+588,34
@@
struct map_baseinfo {
int new_num_max;
};
int new_num_max;
};
-static Res zebra_open_res (ZebraHandle zh)
+static void zebra_open_res(ZebraHandle zh)
{
{
- Res res = 0;
char fname[512];
ASSERTZH;
zh->errCode = 0;
if (zh->path_reg)
{
char fname[512];
ASSERTZH;
zh->errCode = 0;
if (zh->path_reg)
{
- sprintf (fname, "%.200s/zebra.cfg", zh->path_reg);
- res = res_open (fname, zh->service->global_res, 0);
- if (!res)
- res = zh->service->global_res;
+ sprintf(fname, "%.200s/zebra.cfg", zh->path_reg);
+ zh->res = res_open(zh->session_res, 0);
+ res_read_file(zh->res, fname);
}
else if (*zh->reg_name == 0)
{
}
else if (*zh->reg_name == 0)
{
- res = zh->service->global_res;
+ zh->res = res_open(zh->session_res, 0);
}
else
{
yaz_log (YLOG_WARN, "no register root specified");
}
else
{
yaz_log (YLOG_WARN, "no register root specified");
- return 0; /* no path for register - fail! */
+ zh->res = 0; /* no path for register - fail! */
}
}
- return res;
}
static void zebra_close_res (ZebraHandle zh)
{
ASSERTZH;
zh->errCode = 0;
}
static void zebra_close_res (ZebraHandle zh)
{
ASSERTZH;
zh->errCode = 0;
- if (zh->res != zh->service->global_res)
- res_close (zh->res);
+ res_close (zh->res);
zh->res = 0;
}
zh->res = 0;
}
@@
-655,7
+656,7
@@
static void zebra_select_register (ZebraHandle zh, const char *new_reg)
strcat (zh->path_reg, zh->reg_name);
}
}
strcat (zh->path_reg, zh->reg_name);
}
}
- zh->res = zebra_open_res (zh);
+ zebra_open_res(zh);
if (zh->lock_normal)
zebra_lock_destroy (zh->lock_normal);
if (zh->lock_normal)
zebra_lock_destroy (zh->lock_normal);
@@
-668,7
+669,7
@@
static void zebra_select_register (ZebraHandle zh, const char *new_reg)
if (zh->res)
{
char fname[512];
if (zh->res)
{
char fname[512];
- const char *lock_area =res_get (zh->res, "lockDir");
+ const char *lock_area = res_get (zh->res, "lockDir");
if (!lock_area && zh->path_reg)
res_set (zh->res, "lockDir", zh->path_reg);
if (!lock_area && zh->path_reg)
res_set (zh->res, "lockDir", zh->path_reg);
@@
-749,8
+750,8
@@
int zebra_select_default_database(ZebraHandle zh)
/* no database has been selected - so we select based on
resource setting (including group)
*/
/* no database has been selected - so we select based on
resource setting (including group)
*/
- const char *group = res_get(zh->service->global_res, "group");
- const char *v = res_get_prefix(zh->service->global_res,
+ const char *group = res_get(zh->session_res, "group");
+ const char *v = res_get_prefix(zh->session_res,
"database", group, "Default");
return zebra_select_database(zh, v);
}
"database", group, "Default");
return zebra_select_database(zh, v);
}
@@
-777,7
+778,7
@@
void map_basenames (ZebraHandle zh, ODR stream,
odr_malloc (stream, sizeof(*info.new_basenames) * info.new_num_max);
info.mem = stream->mem;
odr_malloc (stream, sizeof(*info.new_basenames) * info.new_num_max);
info.mem = stream->mem;
- res_trav (zh->service->global_res, "mapdb", &info, map_basenames_func);
+ res_trav (zh->session_res, "mapdb", &info, map_basenames_func);
for (i = 0; i<p->num_bases; i++)
if (p->basenames[i] && p->new_num_bases < p->new_num_max)
for (i = 0; i<p->num_bases; i++)
if (p->basenames[i] && p->new_num_bases < p->new_num_max)
@@
-1623,9
+1624,9
@@
ZEBRA_RES zebra_begin_trans(ZebraHandle zh, int rw)
}
zebra_set_state (zh, 'd', seqno);
}
zebra_set_state (zh, 'd', seqno);
- zh->reg = zebra_register_open (zh->service, zh->reg_name,
- 1, rval ? 1 : 0, zh->res,
- zh->path_reg);
+ zh->reg = zebra_register_open(zh->service, zh->reg_name,
+ 1, rval ? 1 : 0, zh->res,
+ zh->path_reg);
if (zh->reg)
zh->reg->seqno = seqno;
else
if (zh->reg)
zh->reg->seqno = seqno;
else
@@
-1704,9
+1705,9
@@
ZEBRA_RES zebra_begin_trans(ZebraHandle zh, int rw)
resultSetInvalidate (zh);
zebra_register_close (zh->service, zh->reg);
}
resultSetInvalidate (zh);
zebra_register_close (zh->service, zh->reg);
}
- zh->reg = zebra_register_open (zh->service, zh->reg_name,
- 0, val == 'c' ? 1 : 0,
- zh->res, zh->path_reg);
+ zh->reg = zebra_register_open(zh->service, zh->reg_name,
+ 0, val == 'c' ? 1 : 0,
+ zh->res, zh->path_reg);
if (!zh->reg)
{
zebra_unlock (zh->lock_normal);
if (!zh->reg)
{
zebra_unlock (zh->lock_normal);
diff --git
a/index/zebrash.c
b/index/zebrash.c
index
c9bbda4
..
b11a63e
100644
(file)
--- a/
index/zebrash.c
+++ b/
index/zebrash.c
@@
-1,4
+1,4
@@
-/* $Id: zebrash.c,v 1.34 2005-06-14 20:28:54 adam Exp $
+/* $Id: zebrash.c,v 1.35 2005-09-13 11:51:06 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-193,7
+193,7
@@
static int cmd_zebra_open( char *args[], WRBUF outbuff)
if (!zs)
wrbuf_puts(outbuff,"zebra seems not to have been started, "
"trying anyway\n");
if (!zs)
wrbuf_puts(outbuff,"zebra seems not to have been started, "
"trying anyway\n");
- zh=zebra_open(zs);
+ zh = zebra_open(zs, 0);
return 0; /* ok */
}
return 0; /* ok */
}
diff --git
a/index/zserver.c
b/index/zserver.c
index
118887a
..
f1c92c4
100644
(file)
--- a/
index/zserver.c
+++ b/
index/zserver.c
@@
-1,4
+1,4
@@
-/* $Id: zserver.c,v 1.139 2005-08-22 09:04:18 adam Exp $
+/* $Id: zserver.c,v 1.140 2005-09-13 11:51:06 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-76,7
+76,7
@@
bend_initresult *bend_init (bend_initrequest *q)
yaz_log (YLOG_DEBUG, "bend_init");
sob = statserv_getcontrol ();
yaz_log (YLOG_DEBUG, "bend_init");
sob = statserv_getcontrol ();
- if (!(zh = zebra_open (sob->handle)))
+ if (!(zh = zebra_open (sob->handle, 0)))
{
yaz_log (YLOG_WARN, "Failed to read config `%s'", sob->configname);
r->errcode = YAZ_BIB1_PERMANENT_SYSTEM_ERROR;
{
yaz_log (YLOG_WARN, "Failed to read config `%s'", sob->configname);
r->errcode = YAZ_BIB1_PERMANENT_SYSTEM_ERROR;
diff --git
a/test/api/safari1.c
b/test/api/safari1.c
index
3f3c6da
..
02dfdfa
100644
(file)
--- a/
test/api/safari1.c
+++ b/
test/api/safari1.c
@@
-1,4
+1,4
@@
-/* $Id: safari1.c,v 1.5 2005-05-03 09:11:37 adam Exp $
+/* $Id: safari1.c,v 1.6 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-60,7
+60,7
@@
int main(int argc, char **argv)
zint limits[3];
ZebraService zs = start_up("safari.cfg", argc, argv);
zint limits[3];
ZebraService zs = start_up("safari.cfg", argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, myrec);
do_query(__LINE__, zh, "@attr 1=any the", 3);
init_data(zh, myrec);
do_query(__LINE__, zh, "@attr 1=any the", 3);
diff --git
a/test/api/t1.c
b/test/api/t1.c
index
3f6a7ca
..
731c390
100644
(file)
--- a/
test/api/t1.c
+++ b/
test/api/t1.c
@@
-1,4
+1,4
@@
-/* $Id: t1.c,v 1.12 2005-01-15 19:38:35 adam Exp $
+/* $Id: t1.c,v 1.13 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-28,7
+28,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
return close_down(zh, zs, 0);
}
return close_down(zh, zs, 0);
}
diff --git
a/test/api/t10.c
b/test/api/t10.c
index
56b68a2
..
97b3c67
100644
(file)
--- a/
test/api/t10.c
+++ b/
test/api/t10.c
@@
-1,4
+1,4
@@
-/* $Id: t10.c,v 1.8 2005-05-24 11:35:43 adam Exp $
+/* $Id: t10.c,v 1.9 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-74,13
+74,13
@@
int main(int argc, char **argv)
{
int i;
ZebraService zs = start_up("zebrazv.cfg", argc, argv);
{
int i;
ZebraService zs = start_up("zebrazv.cfg", argc, argv);
- ZebraHandle zh = zebra_open (zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, recs);
zebra_close(zh);
for (i = 0; tests[i].schema; i++)
{
init_data(zh, recs);
zebra_close(zh);
for (i = 0; tests[i].schema; i++)
{
- zh = zebra_open (zs);
+ zh = zebra_open(zs, 0);
zebra_select_database(zh, "Default");
zebra_set_resource(zh, "zvrank.weighting-scheme", tests[i].schema);
yaz_log(YLOG_LOG,"============%d: %s ===========", i, tests[i].schema);
zebra_select_database(zh, "Default");
zebra_set_resource(zh, "zvrank.weighting-scheme", tests[i].schema);
yaz_log(YLOG_LOG,"============%d: %s ===========", i, tests[i].schema);
diff --git
a/test/api/t11.c
b/test/api/t11.c
index
ab59f20
..
8748ec0
100644
(file)
--- a/
test/api/t11.c
+++ b/
test/api/t11.c
@@
-1,4
+1,4
@@
-/* $Id: t11.c,v 1.2 2005-05-02 09:25:12 adam Exp $
+/* $Id: t11.c,v 1.3 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-32,7
+32,7
@@
const char *myrec[] = {
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, myrec);
init_data(zh, myrec);
diff --git
a/test/api/t12.c
b/test/api/t12.c
index
f20264a
..
ede4022
100644
(file)
--- a/
test/api/t12.c
+++ b/
test/api/t12.c
@@
-1,4
+1,4
@@
-/* $Id: t12.c,v 1.1 2005-05-09 13:22:44 adam Exp $
+/* $Id: t12.c,v 1.2 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-29,13
+29,13
@@
int main(int argc, char **argv)
int i;
int no_db = 140;
ZebraService zs = start_up(0, argc, argv);
int i;
int no_db = 140;
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
zebra_select_database(zh, "Default");
zebra_init(zh);
zebra_close(zh);
zebra_select_database(zh, "Default");
zebra_init(zh);
zebra_close(zh);
- zh = zebra_open (zs);
+ zh = zebra_open(zs, 0);
zebra_begin_trans (zh, 1);
for (i = 0; i<no_db; i++)
zebra_begin_trans (zh, 1);
for (i = 0; i<no_db; i++)
@@
-52,7
+52,7
@@
int main(int argc, char **argv)
}
zebra_end_trans(zh);
zebra_close(zh);
}
zebra_end_trans(zh);
zebra_close(zh);
- zh = zebra_open(zs);
+ zh = zebra_open(zs, 0);
for (i = 0; i<=no_db; i++)
{
char dbstr[20];
for (i = 0; i<=no_db; i++)
{
char dbstr[20];
diff --git
a/test/api/t13.c
b/test/api/t13.c
index
2a8bdfd
..
360ba73
100644
(file)
--- a/
test/api/t13.c
+++ b/
test/api/t13.c
@@
-1,4
+1,4
@@
-/* $Id: t13.c,v 1.1 2005-08-17 21:30:31 adam Exp $
+/* $Id: t13.c,v 1.2 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-47,7
+47,7
@@
void tst()
if (!zs)
exit(2);
if (!zs)
exit(2);
- zh = zebra_open(zs);
+ zh = zebra_open(zs, 0);
zebra_select_database(zh, "Default");
zebra_select_database(zh, "Default");
diff --git
a/test/api/t2.c
b/test/api/t2.c
index
6f98f18
..
6dacdd0
100644
(file)
--- a/
test/api/t2.c
+++ b/
test/api/t2.c
@@
-1,4
+1,4
@@
-/* $Id: t2.c,v 1.16 2005-01-15 19:38:35 adam Exp $
+/* $Id: t2.c,v 1.17 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-31,7
+31,7
@@
const char *myrec[] = {
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, myrec);
do_query(__LINE__,zh, "@attr 1=4 my", 1);
init_data(zh, myrec);
do_query(__LINE__,zh, "@attr 1=4 my", 1);
diff --git
a/test/api/t3.c
b/test/api/t3.c
index
8164a0d
..
7117907
100644
(file)
--- a/
test/api/t3.c
+++ b/
test/api/t3.c
@@
-1,4
+1,4
@@
-/* $Id: t3.c,v 1.17 2005-04-15 10:47:49 adam Exp $
+/* $Id: t3.c,v 1.18 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-35,7
+35,7
@@
int main(int argc, char **argv)
{
int i;
ZebraService zs = start_up(0, argc, argv);
{
int i;
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, myrec);
init_data(zh, myrec);
diff --git
a/test/api/t4.c
b/test/api/t4.c
index
fb1d82b
..
74687a5
100644
(file)
--- a/
test/api/t4.c
+++ b/
test/api/t4.c
@@
-1,4
+1,4
@@
-/* $Id: t4.c,v 1.17 2005-05-11 12:39:37 adam Exp $
+/* $Id: t4.c,v 1.18 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-39,7
+39,7
@@
int main(int argc, char **argv)
int number_to_fetch = 5;
ZebraService zs = start_up(0, argc, argv);
int number_to_fetch = 5;
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, myrec);
init_data(zh, myrec);
@@
-53,7
+53,7
@@
int main(int argc, char **argv)
zebra_stop(zs);
zs = start_service("");
zebra_stop(zs);
zs = start_service("");
- zh = zebra_open(zs);
+ zh = zebra_open(zs, 0);
zebra_select_database(zh, "Default");
zebra_set_resource(zh, "sortmax", "3"); /* make small sort boundary */
zebra_select_database(zh, "Default");
zebra_set_resource(zh, "sortmax", "3"); /* make small sort boundary */
diff --git
a/test/api/t5.c
b/test/api/t5.c
index
d86095d
..
3705efe
100644
(file)
--- a/
test/api/t5.c
+++ b/
test/api/t5.c
@@
-1,4
+1,4
@@
-/* $Id: t5.c,v 1.13 2005-06-23 06:45:47 adam Exp $
+/* $Id: t5.c,v 1.14 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-33,7
+33,7
@@
const char *myrec[] = {
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, myrec);
init_data(zh, myrec);
diff --git
a/test/api/t6.c
b/test/api/t6.c
index
5d73bf2
..
ab8b259
100644
(file)
--- a/
test/api/t6.c
+++ b/
test/api/t6.c
@@
-1,4
+1,4
@@
-/* $Id: t6.c,v 1.10 2005-08-05 10:40:13 adam Exp $
+/* $Id: t6.c,v 1.11 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-28,7
+28,7
@@
int main(int argc, char **argv)
{
int i;
ZebraService zs = start_up("zebra6.cfg", argc, argv);
{
int i;
ZebraService zs = start_up("zebra6.cfg", argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
srand(17);
srand(17);
@@
-40,7
+40,7
@@
int main(int argc, char **argv)
{
int l;
{
int l;
- zh = zebra_open (zs);
+ zh = zebra_open (zs, 0);
zebra_select_database(zh, "Default");
zebra_begin_trans (zh, 1);
zebra_select_database(zh, "Default");
zebra_begin_trans (zh, 1);
@@
-73,7
+73,7
@@
int main(int argc, char **argv)
zebra_end_trans(zh);
zebra_close(zh);
}
zebra_end_trans(zh);
zebra_close(zh);
}
- zh = zebra_open(zs);
+ zh = zebra_open(zs, 0);
zebra_select_database(zh, "Default");
zebra_select_database(zh, "Default");
diff --git
a/test/api/t7.c
b/test/api/t7.c
index
0c4d308
..
cdae308
100644
(file)
--- a/
test/api/t7.c
+++ b/
test/api/t7.c
@@
-1,4
+1,4
@@
-/* $Id: t7.c,v 1.9 2005-05-11 12:39:38 adam Exp $
+/* $Id: t7.c,v 1.10 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-40,7
+40,7
@@
int main(int argc, char **argv)
int status;
ZEBRA_RES ret;
ZebraService zs = start_up(0, argc, argv);
int status;
ZEBRA_RES ret;
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open (zs);
+ ZebraHandle zh = zebra_open (zs, 0);
ODR odr_input = odr_createmem (ODR_DECODE);
ODR odr_output = odr_createmem (ODR_ENCODE);
YAZ_PQF_Parser parser = yaz_pqf_create();
ODR odr_input = odr_createmem (ODR_DECODE);
ODR odr_output = odr_createmem (ODR_ENCODE);
YAZ_PQF_Parser parser = yaz_pqf_create();
diff --git
a/test/api/t8.c
b/test/api/t8.c
index
9b8c60a
..
2cc3c3d
100644
(file)
--- a/
test/api/t8.c
+++ b/
test/api/t8.c
@@
-1,4
+1,4
@@
-/* $Id: t8.c,v 1.7 2005-01-15 19:38:35 adam Exp $
+/* $Id: t8.c,v 1.8 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-60,7
+60,7
@@
const char *recs[] = {
int main(int argc, char **argv)
{
ZebraService zs = start_up("zebra8.cfg", argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up("zebra8.cfg", argc, argv);
- ZebraHandle zh = zebra_open (zs);
+ ZebraHandle zh = zebra_open (zs, 0);
init_data(zh, recs);
init_data(zh, recs);
diff --git
a/test/api/t9.c
b/test/api/t9.c
index
435991e
..
3f55218
100644
(file)
--- a/
test/api/t9.c
+++ b/
test/api/t9.c
@@
-1,4
+1,4
@@
-/* $Id: t9.c,v 1.6 2005-05-24 11:35:43 adam Exp $
+/* $Id: t9.c,v 1.7 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-32,7
+32,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, recs);
init_data(zh, recs);
diff --git
a/test/api/testlib.c
b/test/api/testlib.c
index
79cdc41
..
7aad44e
100644
(file)
--- a/
test/api/testlib.c
+++ b/
test/api/testlib.c
@@
-1,4
+1,4
@@
-/* $Id: testlib.c,v 1.26 2005-08-18 12:50:18 adam Exp $
+/* $Id: testlib.c,v 1.27 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-94,7
+94,7
@@
const char *get_srcdir()
}
/** start_service - do a zebra_start with a decent config name */
}
/** start_service - do a zebra_start with a decent config name */
-ZebraService start_service(char *cfgname)
+ZebraService start_service(const char *cfgname)
{
char cfg[256];
const char *srcdir = get_srcdir();
{
char cfg[256];
const char *srcdir = get_srcdir();
@@
-103,7
+103,7
@@
ZebraService start_service(char *cfgname)
cfgname="zebra.cfg";
sprintf(cfg, "%.200s/%.50s", srcdir, cfgname);
cfgname="zebra.cfg";
sprintf(cfg, "%.200s/%.50s", srcdir, cfgname);
- zs=zebra_start(cfg);
+ zs = zebra_start(cfg);
if (!zs)
{
printf("zebra_start failed, probably because missing config file \n"
if (!zs)
{
printf("zebra_start failed, probably because missing config file \n"
diff --git
a/test/api/testlib.h
b/test/api/testlib.h
index
ce7c1d0
..
132ef95
100644
(file)
--- a/
test/api/testlib.h
+++ b/
test/api/testlib.h
@@
-1,4
+1,4
@@
-/* $Id: testlib.h,v 1.15 2005-08-09 12:30:47 adam Exp $
+/* $Id: testlib.h,v 1.16 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-56,7
+56,7
@@
void start_log(int argc, char **argv);
* and uses that if need be.
* The name defaults to zebra.cfg, if null or emtpy
*/
* and uses that if need be.
* The name defaults to zebra.cfg, if null or emtpy
*/
-ZebraService start_service(char *cfgname);
+ZebraService start_service(const char *cfgname);
/**
/**
diff --git
a/test/charmap/charmap1.c
b/test/charmap/charmap1.c
index
4861fff
..
73afa88
100644
(file)
--- a/
test/charmap/charmap1.c
+++ b/
test/charmap/charmap1.c
@@
-1,4
+1,4
@@
-/* $Id: charmap1.c,v 1.7 2005-06-14 12:42:19 adam Exp $
+/* $Id: charmap1.c,v 1.8 2005-09-13 11:51:07 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-25,7
+25,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
check_filter(zs, "grs.xml");
char path[256];
check_filter(zs, "grs.xml");
diff --git
a/test/espec/t1.c
b/test/espec/t1.c
index
d82ae6d
..
f168a9b
100644
(file)
--- a/
test/espec/t1.c
+++ b/
test/espec/t1.c
@@
-1,4
+1,4
@@
-/* $Id: t1.c,v 1.4 2005-01-15 19:38:35 adam Exp $
+/* $Id: t1.c,v 1.5 2005-09-13 11:51:08 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-25,7
+25,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
int i, errs = 0;
char path[256];
int i, errs = 0;
diff --git
a/test/filters/grs.marc.c
b/test/filters/grs.marc.c
index
16707af
..
ff7aac9
100644
(file)
--- a/
test/filters/grs.marc.c
+++ b/
test/filters/grs.marc.c
@@
-1,4
+1,4
@@
-/* $Id: grs.marc.c,v 1.1 2005-06-14 20:03:02 adam Exp $
+/* $Id: grs.marc.c,v 1.2 2005-09-13 11:51:08 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-25,7
+25,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
check_filter(zs, "grs.marc");
char path[256];
check_filter(zs, "grs.marc");
diff --git
a/test/filters/grs.xml.c
b/test/filters/grs.xml.c
index
add4249
..
4941910
100644
(file)
--- a/
test/filters/grs.xml.c
+++ b/
test/filters/grs.xml.c
@@
-1,4
+1,4
@@
-/* $Id: grs.xml.c,v 1.1 2005-06-14 20:03:02 adam Exp $
+/* $Id: grs.xml.c,v 1.2 2005-09-13 11:51:08 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-25,7
+25,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
check_filter(zs, "grs.xml");
char path[256];
check_filter(zs, "grs.xml");
diff --git
a/test/filters/text.c
b/test/filters/text.c
index
88a5385
..
4880eb3
100644
(file)
--- a/
test/filters/text.c
+++ b/
test/filters/text.c
@@
-1,4
+1,4
@@
-/* $Id: text.c,v 1.1 2005-06-14 20:03:02 adam Exp $
+/* $Id: text.c,v 1.2 2005-09-13 11:51:08 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-25,7
+25,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
check_filter(zs, "text");
char path[256];
check_filter(zs, "text");
diff --git
a/test/marcxml/t1.c
b/test/marcxml/t1.c
index
36a9c4d
..
9b4aa64
100644
(file)
--- a/
test/marcxml/t1.c
+++ b/
test/marcxml/t1.c
@@
-1,4
+1,4
@@
-/* $Id: t1.c,v 1.5 2005-04-28 08:20:41 adam Exp $
+/* $Id: t1.c,v 1.6 2005-09-13 11:51:08 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-25,7
+25,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
check_filter(zs, "grs.xml");
char path[256];
check_filter(zs, "grs.xml");
diff --git
a/test/marcxml/t2.c
b/test/marcxml/t2.c
index
e947f51
..
fc854c7
100644
(file)
--- a/
test/marcxml/t2.c
+++ b/
test/marcxml/t2.c
@@
-1,4
+1,4
@@
-/* $Id: t2.c,v 1.4 2005-04-28 08:20:41 adam Exp $
+/* $Id: t2.c,v 1.5 2005-09-13 11:51:08 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-25,7
+25,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
zebra_select_database(zh, "Default");
char path[256];
zebra_select_database(zh, "Default");
diff --git
a/test/mbox/mbox1.c
b/test/mbox/mbox1.c
index
82c7ed8
..
f2d83d5
100644
(file)
--- a/
test/mbox/mbox1.c
+++ b/
test/mbox/mbox1.c
@@
-1,4
+1,4
@@
-/* $Id: mbox1.c,v 1.1 2005-04-28 09:18:20 adam Exp $
+/* $Id: mbox1.c,v 1.2 2005-09-13 11:51:08 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-27,7
+27,7
@@
int main(int argc, char **argv)
char path[256];
ZebraService zs = start_up(0, argc, argv);
char path[256];
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
check_filter(zs, "grs.regx");
zebra_select_database(zh, "Default");
check_filter(zs, "grs.regx");
zebra_select_database(zh, "Default");
diff --git
a/test/rusmarc/t1.c
b/test/rusmarc/t1.c
index
d0381e6
..
dafda87
100644
(file)
--- a/
test/rusmarc/t1.c
+++ b/
test/rusmarc/t1.c
@@
-1,4
+1,4
@@
-/* $Id: t1.c,v 1.3 2005-01-15 19:38:39 adam Exp $
+/* $Id: t1.c,v 1.4 2005-09-13 11:51:09 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-39,7
+39,7
@@
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
check_koi8r();
char path[256];
check_koi8r();
diff --git
a/test/sort/sort1.c
b/test/sort/sort1.c
index
b86d22b
..
2b4d8aa
100644
(file)
--- a/
test/sort/sort1.c
+++ b/
test/sort/sort1.c
@@
-1,4
+1,4
@@
-/* $Id: sort1.c,v 1.5 2005-08-09 12:30:47 adam Exp $
+/* $Id: sort1.c,v 1.6 2005-09-13 11:51:09 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-26,7
+26,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
zint ids[5];
char path[256];
int i;
zint ids[5];
char path[256];
int i;
diff --git
a/test/sort2/t1.c
b/test/sort2/t1.c
index
4812c02
..
c69ba76
100644
(file)
--- a/
test/sort2/t1.c
+++ b/
test/sort2/t1.c
@@
-1,4
+1,4
@@
-/* $Id: t1.c,v 1.3 2005-08-09 12:30:48 adam Exp $
+/* $Id: t1.c,v 1.4 2005-09-13 11:51:10 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-25,7
+25,7
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
int i;
zint ids[5];
char path[256];
int i;
zint ids[5];
diff --git
a/test/xpath/xpath1.c
b/test/xpath/xpath1.c
index
99c8198
..
4a40070
100644
(file)
--- a/
test/xpath/xpath1.c
+++ b/
test/xpath/xpath1.c
@@
-1,4
+1,4
@@
-/* $Id: xpath1.c,v 1.3 2005-01-15 19:38:40 adam Exp $
+/* $Id: xpath1.c,v 1.4 2005-09-13 11:51:10 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-39,7
+39,7
@@
int main(int argc, char **argv)
0};
zs = start_up(0, argc, argv);
0};
zs = start_up(0, argc, argv);
- zh = zebra_open(zs);
+ zh = zebra_open(zs, 0);
init_data(zh, myrec);
do_query(__LINE__,zh, "@attr 1=/sgml/tag before", 0);
init_data(zh, myrec);
do_query(__LINE__,zh, "@attr 1=/sgml/tag before", 0);
diff --git
a/test/xpath/xpath2.c
b/test/xpath/xpath2.c
index
1d8e40f
..
a7d0b00
100644
(file)
--- a/
test/xpath/xpath2.c
+++ b/
test/xpath/xpath2.c
@@
-1,4
+1,4
@@
-/* $Id: xpath2.c,v 1.3 2005-01-15 19:38:40 adam Exp $
+/* $Id: xpath2.c,v 1.4 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-72,7
+72,7
@@
const char *myrec[] = {
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open (zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, myrec);
do_query(__LINE__,zh, "@attr 1=/Zthes/termName Sauropoda", 1);
init_data(zh, myrec);
do_query(__LINE__,zh, "@attr 1=/Zthes/termName Sauropoda", 1);
diff --git
a/test/xpath/xpath3.c
b/test/xpath/xpath3.c
index
5238633
..
84311ed
100644
(file)
--- a/
test/xpath/xpath3.c
+++ b/
test/xpath/xpath3.c
@@
-1,5
+1,5
@@
-/* $Id: xpath3.c,v 1.4 2005-01-15 19:38:40 adam Exp $
+/* $Id: xpath3.c,v 1.5 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-39,7
+39,7
@@
const char *myrec[] = {
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, myrec);
#define q(qry,hits) do_query(__LINE__,zh,qry,hits)
init_data(zh, myrec);
#define q(qry,hits) do_query(__LINE__,zh,qry,hits)
diff --git
a/test/xpath/xpath4.c
b/test/xpath/xpath4.c
index
714df3a
..
7b50656
100644
(file)
--- a/
test/xpath/xpath4.c
+++ b/
test/xpath/xpath4.c
@@
-1,4
+1,4
@@
-/* $Id: xpath4.c,v 1.3 2005-01-15 19:38:40 adam Exp $
+/* $Id: xpath4.c,v 1.4 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-86,7
+86,7
@@
const char *myrec[] = {
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
#if 0
yaz_log_init_level( yaz_log_mask_str_x("xpath4,rsbetween", LOG_DEFAULT_LEVEL));
#if 0
yaz_log_init_level( yaz_log_mask_str_x("xpath4,rsbetween", LOG_DEFAULT_LEVEL));
diff --git
a/test/xpath/xpath5.c
b/test/xpath/xpath5.c
index
4ca43ab
..
0ffc2fd
100644
(file)
--- a/
test/xpath/xpath5.c
+++ b/
test/xpath/xpath5.c
@@
-1,4
+1,4
@@
-/* $Id: xpath5.c,v 1.3 2005-01-15 19:38:40 adam Exp $
+/* $Id: xpath5.c,v 1.4 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-58,7
+58,7
@@
const char *recs[] = {
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
int main(int argc, char **argv)
{
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
init_data(zh, recs);
// yaz_log_init_level(LOG_ALL);
init_data(zh, recs);
// yaz_log_init_level(LOG_ALL);
diff --git
a/test/xpath/xpath6.c
b/test/xpath/xpath6.c
index
9828f8d
..
8313d39
100644
(file)
--- a/
test/xpath/xpath6.c
+++ b/
test/xpath/xpath6.c
@@
-1,4
+1,4
@@
-/* $Id: xpath6.c,v 1.4 2005-06-29 16:52:27 adam Exp $
+/* $Id: xpath6.c,v 1.5 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-26,7
+26,7
@@
int main(int argc, char **argv)
{
int i;
ZebraService zs = start_up(0, argc, argv);
{
int i;
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
char path[256];
zebra_select_database(zh, "Default");
char path[256];
zebra_select_database(zh, "Default");
diff --git
a/test/xslt/xslt1.c
b/test/xslt/xslt1.c
index
8266fe5
..
1e7835a
100644
(file)
--- a/
test/xslt/xslt1.c
+++ b/
test/xslt/xslt1.c
@@
-1,4
+1,4
@@
-/* $Id: xslt1.c,v 1.4 2005-08-18 12:50:20 adam Exp $
+/* $Id: xslt1.c,v 1.5 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-27,7
+27,7
@@
int main(int argc, char **argv)
char path[256];
ZebraService zs = start_up(0, argc, argv);
char path[256];
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
check_filter(zs, "xslt");
check_filter(zs, "xslt");
diff --git
a/test/xslt/xslt2.c
b/test/xslt/xslt2.c
index
0d63762
..
1929ca7
100644
(file)
--- a/
test/xslt/xslt2.c
+++ b/
test/xslt/xslt2.c
@@
-1,4
+1,4
@@
-/* $Id: xslt2.c,v 1.4 2005-08-18 12:50:20 adam Exp $
+/* $Id: xslt2.c,v 1.5 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-34,7
+34,7
@@
int main(int argc, char **argv)
size_t r;
ZebraService zs = start_up(0, argc, argv);
size_t r;
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
check_filter(zs, "xslt");
check_filter(zs, "xslt");
diff --git
a/test/xslt/xslt3.c
b/test/xslt/xslt3.c
index
7bab9e8
..
c0d949c
100644
(file)
--- a/
test/xslt/xslt3.c
+++ b/
test/xslt/xslt3.c
@@
-1,4
+1,4
@@
-/* $Id: xslt3.c,v 1.3 2005-08-18 12:50:20 adam Exp $
+/* $Id: xslt3.c,v 1.4 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-34,7
+34,7
@@
int main(int argc, char **argv)
size_t r;
ZebraService zs = start_up(0, argc, argv);
size_t r;
ZebraService zs = start_up(0, argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
check_filter(zs, "xslt");
check_filter(zs, "xslt");
diff --git
a/test/xslt/xslt4.c
b/test/xslt/xslt4.c
index
26d1a9c
..
8c47f40
100644
(file)
--- a/
test/xslt/xslt4.c
+++ b/
test/xslt/xslt4.c
@@
-1,4
+1,4
@@
-/* $Id: xslt4.c,v 1.1 2005-08-18 12:50:20 adam Exp $
+/* $Id: xslt4.c,v 1.2 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-27,7
+27,7
@@
int main(int argc, char **argv)
char path[256];
ZebraService zs = start_up("zebrastaticrank.cfg", argc, argv);
char path[256];
ZebraService zs = start_up("zebrastaticrank.cfg", argc, argv);
- ZebraHandle zh = zebra_open(zs);
+ ZebraHandle zh = zebra_open(zs, 0);
check_filter(zs, "xslt");
check_filter(zs, "xslt");
diff --git
a/util/res.c
b/util/res.c
index
15e65e5
..
417cc0a
100644
(file)
--- a/
util/res.c
+++ b/
util/res.c
@@
-1,4
+1,4
@@
-/* $Id: res.c,v 1.44 2005-08-17 21:28:07 adam Exp $
+/* $Id: res.c,v 1.45 2005-09-13 11:51:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
Copyright (C) 1995-2005
Index Data ApS
@@
-42,22
+42,20
@@
struct res_entry {
struct res_struct {
struct res_entry *first, *last;
struct res_struct {
struct res_entry *first, *last;
- char *name;
- int init;
Res def_res;
Res over_res;
};
Res def_res;
Res over_res;
};
-static struct res_entry *add_entry (Res r)
+static struct res_entry *add_entry(Res r)
{
struct res_entry *resp;
if (!r->first)
resp = r->last = r->first =
{
struct res_entry *resp;
if (!r->first)
resp = r->last = r->first =
- (struct res_entry *) xmalloc (sizeof(*resp));
+ (struct res_entry *) xmalloc(sizeof(*resp));
else
{
else
{
- resp = (struct res_entry *) xmalloc (sizeof(*resp));
+ resp = (struct res_entry *) xmalloc(sizeof(*resp));
r->last->next = resp;
r->last = resp;
}
r->last->next = resp;
r->last = resp;
}
@@
-134,7
+132,7
@@
static char *xstrdup_env(const char *src)
return dst;
}
return dst;
}
-static void reread (Res r)
+ZEBRA_RES res_read_file(Res r, const char *fname)
{
struct res_entry *resp;
char *line;
{
struct res_entry *resp;
char *line;
@@
-143,38
+141,21
@@
static void reread (Res r)
char fr_buf[1024];
FILE *fr;
char fr_buf[1024];
FILE *fr;
- assert (r);
- r->init = 1;
-
- if (!r->name)
- return;
+ assert(r);
- fr = fopen (r->name, "r");
+ fr = fopen(fname, "r");
if (!fr)
{
if (!fr)
{
- yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", r->name);
- return ;
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", fname);
+ return ZEBRA_FAIL;
}
}
- val_buf = (char*) xmalloc (val_max);
+ val_buf = (char*) xmalloc(val_max);
while (1)
{
while (1)
{
- line = fgets (fr_buf, sizeof(fr_buf)-1, fr);
+ line = fgets(fr_buf, sizeof(fr_buf)-1, fr);
if (!line)
break;
if (!line)
break;
- if (*line == '#')
- {
- int no = 0;
-
- while (fr_buf[no] && fr_buf[no] != '\n')
- no++;
- fr_buf[no] = '\0';
-
- resp = add_entry (r);
- resp->name = (char*) xmalloc (no+1);
- resp->value = NULL;
- strcpy (resp->name, fr_buf);
- }
- else
+ if (*line != '#')
{
int no = 0;
while (1)
{
int no = 0;
while (1)
@@
-184,18
+165,18
@@
static void reread (Res r)
no = 0;
break;
}
no = 0;
break;
}
- if (strchr (": \t", fr_buf[no]))
+ if (strchr(": \t", fr_buf[no]))
break;
no++;
}
if (!no)
continue;
fr_buf[no++] = '\0';
break;
no++;
}
if (!no)
continue;
fr_buf[no++] = '\0';
- resp = add_entry (r);
- resp->name = (char*) xmalloc (no);
- strcpy (resp->name, fr_buf);
+ resp = add_entry(r);
+ resp->name = (char*) xmalloc(no);
+ strcpy(resp->name, fr_buf);
- while (strchr (" \t", fr_buf[no]))
+ while (strchr(" \t", fr_buf[no]))
no++;
val_size = 0;
while (1)
no++;
val_size = 0;
while (1)
@@
-208,13
+189,13
@@
static void reread (Res r)
val_size--;
val_buf[val_size] = '\0';
resp->value = xstrdup_env(val_buf);
val_size--;
val_buf[val_size] = '\0';
resp->value = xstrdup_env(val_buf);
- yaz_log (YLOG_DEBUG, "(name=%s,value=%s)",
+ yaz_log(YLOG_DEBUG, "(name=%s,value=%s)",
resp->name, resp->value);
break;
}
resp->name, resp->value);
break;
}
- else if (fr_buf[no] == '\\' && strchr ("\n\r\f", fr_buf[no+1]))
+ else if (fr_buf[no] == '\\' && strchr("\n\r\f", fr_buf[no+1]))
{
{
- line = fgets (fr_buf, sizeof(fr_buf)-1, fr);
+ line = fgets(fr_buf, sizeof(fr_buf)-1, fr);
if (!line)
{
val_buf[val_size] = '\0';
if (!line)
{
val_buf[val_size] = '\0';
@@
-230,77
+211,56
@@
static void reread (Res r)
{
char *nb;
{
char *nb;
- nb = (char*) xmalloc (val_max+=1024);
- memcpy (nb, val_buf, val_size);
- xfree (val_buf);
+ nb = (char*) xmalloc(val_max+=1024);
+ memcpy(nb, val_buf, val_size);
+ xfree(val_buf);
val_buf = nb;
}
}
}
}
}
val_buf = nb;
}
}
}
}
}
- xfree (val_buf);
- fclose (fr);
+ xfree(val_buf);
+ fclose(fr);
+ return ZEBRA_OK;
}
}
-Res res_open (const char *name, Res def_res, Res over_res)
+Res res_open(Res def_res, Res over_res)
{
Res r;
{
Res r;
- if (name)
- {
-#ifdef WIN32
- if (access (name, 4))
-#else
- if (access (name, R_OK))
-#endif
- {
- yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", name);
- return 0;
- }
- }
- r = (Res) xmalloc (sizeof(*r));
- r->init = 0;
+ r = (Res) xmalloc(sizeof(*r));
r->first = r->last = NULL;
r->first = r->last = NULL;
- if (name)
- r->name = xstrdup (name);
- else
- r->name=0;
r->def_res = def_res;
r->over_res = over_res;
return r;
}
r->def_res = def_res;
r->over_res = over_res;
return r;
}
-void res_clear (Res r)
+void res_clear(Res r)
{
{
- if (r->init)
+ struct res_entry *re, *re1;
+ for (re = r->first; re; re=re1)
{
{
- struct res_entry *re, *re1;
- for (re = r->first; re; re=re1)
- {
- if (re->name)
- xfree (re->name);
- if (re->value)
- xfree (re->value);
- re1 = re->next;
- xfree (re);
- }
+ if (re->name)
+ xfree(re->name);
+ if (re->value)
+ xfree(re->value);
+ re1 = re->next;
+ xfree(re);
}
}
- r->init = 0;
r->first = r->last = NULL;
}
r->first = r->last = NULL;
}
-void res_close (Res r)
+void res_close(Res r)
{
if (!r)
return;
res_clear(r);
{
if (!r)
return;
res_clear(r);
- xfree (r->name);
- xfree (r);
+ xfree(r);
}
}
-const char *res_get_prefix (Res r, const char *name, const char *prefix,
+const char *res_get_prefix(Res r, const char *name, const char *prefix,
const char *def)
{
const char *v = 0;;
const char *def)
{
const char *v = 0;;
@@
-322,7
+282,7
@@
const char *res_get_prefix (Res r, const char *name, const char *prefix,
return v;
}
return v;
}
-const char *res_get (Res r, const char *name)
+const char *res_get(Res r, const char *name)
{
struct res_entry *re;
const char *v;
{
struct res_entry *re;
const char *v;
@@
-334,59
+294,55
@@
const char *res_get (Res r, const char *name)
if (v)
return v;
if (v)
return v;
- if (!r->init)
- reread (r);
for (re = r->first; re; re=re->next)
for (re = r->first; re; re=re->next)
- if (re->value && !yaz_matchstr (re->name, name))
+ if (re->value && !yaz_matchstr(re->name, name))
return re->value;
return re->value;
- return res_get (r->def_res, name);
+ return res_get(r->def_res, name);
}
}
-const char *res_get_def (Res r, const char *name, const char *def)
+const char *res_get_def(Res r, const char *name, const char *def)
{
const char *t;
{
const char *t;
- if (!(t = res_get (r, name)))
+ if (!(t = res_get(r, name)))
{
{
- yaz_log (YLOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def);
+ yaz_log(YLOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def);
return def;
}
else
return t;
}
return def;
}
else
return t;
}
-int res_get_match (Res r, const char *name, const char *value, const char *s)
+int res_get_match(Res r, const char *name, const char *value, const char *s)
{
{
- const char *cn = res_get (r, name);
+ const char *cn = res_get(r, name);
if (!cn)
cn = s;
if (!cn)
cn = s;
- if (cn && !yaz_matchstr (cn, value))
+ if (cn && !yaz_matchstr(cn, value))
return 1;
return 0;
}
return 1;
return 0;
}
-void res_set (Res r, const char *name, const char *value)
+void res_set(Res r, const char *name, const char *value)
{
struct res_entry *re;
{
struct res_entry *re;
- assert (r);
- if (!r->init)
- reread (r);
+ assert(r);
for (re = r->first; re; re=re->next)
for (re = r->first; re; re=re->next)
- if (re->value && !yaz_matchstr (re->name, name))
+ if (re->value && !yaz_matchstr(re->name, name))
{
{
- xfree (re->value);
- re->value = xstrdup_env (value);
+ xfree(re->value);
+ re->value = xstrdup_env(value);
return;
}
return;
}
- re = add_entry (r);
- re->name = xstrdup (name);
- re->value = xstrdup_env (value);
+ re = add_entry(r);
+ re->name = xstrdup(name);
+ re->value = xstrdup_env(value);
}
}
-int res_trav (Res r, const char *prefix, void *p,
+int res_trav(Res r, const char *prefix, void *p,
void (*f)(void *p, const char *name, const char *value))
{
struct res_entry *re;
void (*f)(void *p, const char *name, const char *value))
{
struct res_entry *re;
@@
-395,38
+351,35
@@
int res_trav (Res r, const char *prefix, void *p,
if (!r)
return 0;
if (!r)
return 0;
+ no = res_trav(r->over_res, prefix, p, f);
+ if (no)
+ return no;
if (prefix)
l = strlen(prefix);
if (prefix)
l = strlen(prefix);
- if (!r->init)
- reread (r);
for (re = r->first; re; re=re->next)
if (re->value)
for (re = r->first; re; re=re->next)
if (re->value)
- if (l==0 || !memcmp (re->name, prefix, l))
+ if (l==0 || !memcmp(re->name, prefix, l))
{
(*f)(p, re->name, re->value);
no++;
}
if (!no)
{
(*f)(p, re->name, re->value);
no++;
}
if (!no)
- return res_trav (r->def_res, prefix, p, f);
+ return res_trav(r->def_res, prefix, p, f);
return no;
}
return no;
}
-int res_write (Res r)
+ZEBRA_RES res_write_file(Res r, const char *fname)
{
struct res_entry *re;
FILE *fr;
{
struct res_entry *re;
FILE *fr;
- assert (r);
- if (!r->init)
- reread (r);
- if (!r->name)
- return 0; /* ok, this was not from a file */
- fr = fopen (r->name, "w");
+ assert(r);
+ fr = fopen(fname, "w");
if (!fr)
{
if (!fr)
{
- yaz_log (YLOG_FATAL|YLOG_ERRNO, "Cannot create `%s'", r->name);
- exit (1);
+ yaz_log(YLOG_FATAL|YLOG_ERRNO, "Cannot create `%s'", fname);
+ exit(1);
}
for (re = r->first; re; re=re->next)
}
for (re = r->first; re; re=re->next)
@@
-435,10
+388,10
@@
int res_write (Res r)
int lefts = strlen(re->name)+2;
if (!re->value)
int lefts = strlen(re->name)+2;
if (!re->value)
- fprintf (fr, "%s\n", re->name);
+ fprintf(fr, "%s\n", re->name);
else
{
else
{
- fprintf (fr, "%s: ", re->name);
+ fprintf(fr, "%s: ", re->name);
while (lefts + strlen(re->value+no) > 78)
{
int i = 20;
while (lefts + strlen(re->value+no) > 78)
{
int i = 20;
@@
-452,16
+405,16
@@
int res_write (Res r)
if (i<0)
ind = no + 78 - lefts;
for (i = no; i != ind; i++)
if (i<0)
ind = no + 78 - lefts;
for (i = no; i != ind; i++)
- putc (re->value[i], fr);
- fprintf (fr, "\\\n");
+ putc(re->value[i], fr);
+ fprintf(fr, "\\\n");
no=ind;
lefts = 0;
}
no=ind;
lefts = 0;
}
- fprintf (fr, "%s\n", re->value+no);
+ fprintf(fr, "%s\n", re->value+no);
}
}
}
}
- fclose (fr);
- return 0;
+ fclose(fr);
+ return ZEBRA_OK;
}
ZEBRA_RES res_get_int(Res r, const char *name, int *val)
}
ZEBRA_RES res_get_int(Res r, const char *name, int *val)