1 /* $Id: attribute.c,v 1.15.2.1 2006-08-14 10:38:57 adam Exp $
2 Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
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 this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 static data1_att *getatt(data1_attset *p, int att, const char *sattr)
35 data1_attset_child *c;
38 for (a = p->atts; a; a = a->next)
39 if (sattr && !yaz_matchstr(sattr, a->name))
41 else if (a->value == att)
43 /* scan included sets */
44 for (c = p->children; c; c = c->next)
45 if ((a = getatt(c->child, att, sattr)))
50 int att_getentbyatt(ZebraHandle zi, attent *res, oid_value set, int att,
56 if (!(p = data1_attset_search_id (zi->reg->dh, set)))
58 zebraExplain_loadAttsets (zi->reg->dh, zi->res);
59 p = data1_attset_search_id (zi->reg->dh, set);
63 if (!(r = getatt(p, att, sattr)))
65 res->attset_ordinal = r->parent->reference;
66 res->local_attributes = r->locals;