1 /* $Id: attribute.c,v 1.20 2005-03-30 09:25:23 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/res.h>
27 #include <idzebra/util.h>
30 static data1_att *getatt(data1_attset *p, int att, const char *sattr)
33 data1_attset_child *c;
36 for (a = p->atts; a; a = a->next)
37 if (sattr && !yaz_matchstr(sattr, a->name))
39 else if (a->value == att)
41 /* scan included sets */
42 for (c = p->children; c; c = c->next)
43 if ((a = getatt(c->child, att, sattr)))
48 int att_getentbyatt(ZebraHandle zi, attent *res, oid_value set, int att,
54 if (!(p = data1_attset_search_id (zi->reg->dh, set)))
56 zebraExplain_loadAttsets (zi->reg->dh, zi->res);
57 p = data1_attset_search_id (zi->reg->dh, set);
61 if (!(r = getatt(p, att, sattr)))
63 res->attset_ordinal = r->parent->reference;
64 res->local_attributes = r->locals;