1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2009 Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <yaz/wrbuf.h>
24 WRBUF zebra_mk_ord_str(int ord, const char *str)
27 WRBUF w = wrbuf_alloc();
32 len = key_SU_encode(ord, pref);
34 wrbuf_write(w, pref, len);
39 char *dict_lookup_ord(Dict d, int ord, const char *str)
41 WRBUF w = zebra_mk_ord_str(ord, str);
42 char *rinfo = dict_lookup(d, wrbuf_cstr(w));
47 int dict_insert_ord(Dict d, int ord, const char *p,
48 int userlen, void *userinfo)
50 WRBUF w = zebra_mk_ord_str(ord, p);
51 int r = dict_insert(d, wrbuf_cstr(w), userlen, userinfo);
56 int dict_delete_ord(Dict d, int ord, const char *p)
58 WRBUF w = zebra_mk_ord_str(ord, p);
59 int r = dict_delete(d, wrbuf_cstr(w));
64 int dict_delete_subtree_ord(Dict d, int ord, void *client,
65 int (*f)(const char *info, void *client))
67 WRBUF w = zebra_mk_ord_str(ord, "");
68 int r = dict_delete_subtree(d, wrbuf_cstr(w), client, f);
75 * c-file-style: "Stroustrup"
76 * indent-tabs-mode: nil
78 * vim: shiftwidth=4 tabstop=8 expandtab