2 * Copyright (C) 1994-1997, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: attribute.c,v $
7 * Revision 1.7 1997-10-29 12:05:01 adam
8 * Server produces diagnostic "Unsupported Attribute Set" when appropriate.
10 * Revision 1.6 1997/09/17 12:19:11 adam
11 * Zebra version corresponds to YAZ version 1.4.
12 * Changed Zebra server so that it doesn't depend on global common_resource.
14 * Revision 1.5 1997/09/05 15:30:08 adam
15 * Changed prototype for chr_map_input - added const.
16 * Added support for C++, headers uses extern "C" for public definitions.
18 * Revision 1.4 1996/10/29 14:06:48 adam
19 * Include zebrautl.h instead of alexutil.h.
21 * Revision 1.3 1996/05/09 07:28:54 quinn
22 * Work towards phrases and multiple registers
24 * Revision 1.2 1995/11/15 19:13:07 adam
25 * Work on record management.
28 * This interface is used by other modules (the Z-server in particular)
29 * to normalize the attributes given in queries.
39 static void att_loadset(void *p, const char *n, const char *name)
44 if (!(cnew = data1_read_attset(zi->dh, (char*) name)))
46 logf(LOG_WARN|LOG_ERRNO, "%s", name);
49 cnew->next = zi->registered_sets;
50 zi->registered_sets = cnew;
53 static void load_atts(ZServerInfo *zi)
55 res_trav(zi->res, "attset", zi, att_loadset);
58 static data1_att *getatt(data1_attset *p, int att)
62 for (; p; p = p->next)
65 for (a = p->atts; a; a = a->next)
68 /* scan included sets */
69 if (p->children && (a = getatt(p->children, att)))
75 int att_getentbyatt(ZServerInfo *zi, attent *res, oid_value set, int att)
80 if (!zi->registered_sets)
82 for (p = zi->registered_sets; p; p = p->next)
83 if (p->reference == set)
87 if (!(r = getatt(p, att)))
89 res->attset_ordinal = r->parent->ordinal;
90 res->local_attributes = r->locals;