1 /* $Id: t13.c,v 1.3 2005-09-13 13:15:24 adam Exp $
2 Copyright (C) 1995-2005
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
26 #include <idzebra/api.h>
30 Res default_res; /* default resources */
31 Res temp_res; /* temporary resources */
37 default_res = res_open(0, 0); /* completely empty */
40 res_set(default_res, "name1", "value1");
42 temp_res = res_open(0, 0); /* completely empty */
46 zs = zebra_start_res(0, default_res, temp_res);
50 zh = zebra_open(zs, 0);
52 zebra_select_database(zh, "Default");
54 /* run this a few times so we can see leaks easier */
55 for (i = 0; i<10; i++)
57 /* we should find the name1 from default_res */
58 val = zebra_get_resource(zh, "name1", 0);
59 if (!val || strcmp(val, "value1"))
62 /* make local override */
63 res_set(temp_res, "name1", "value2");
64 res_set(temp_res, "name4", "value4");
66 /* we should find the name1 from temp_res */
67 val = zebra_get_resource(zh, "name1", 0);
68 if (!val || strcmp(val, "value2"))
71 val = zebra_get_resource(zh, "name4", 0);
72 if (!val || strcmp(val, "value4"))
82 res_close(default_res);
85 int main(int argc, char **argv)