2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: attribute.c,v $
7 * Revision 1.4 1996-10-29 14:06:48 adam
8 * Include zebrautl.h instead of alexutil.h.
10 * Revision 1.3 1996/05/09 07:28:54 quinn
11 * Work towards phrases and multiple registers
13 * Revision 1.2 1995/11/15 19:13:07 adam
14 * Work on record management.
17 * This interface is used by other modules (the Z-server in particular)
18 * to normalize the attributes given in queries.
25 #include <d1_attset.h>
27 #include "attribute.h"
29 static int initialized = 0;
31 static data1_attset *registered_sets = 0;
33 static void att_loadset(const char *n, const char *name)
37 if (!(new = data1_read_attset((char*) name)))
39 logf(LOG_WARN|LOG_ERRNO, "%s", name);
42 new->next = registered_sets;
43 registered_sets = new;
47 static void load_atts()
49 res_trav(common_resource, "attset", att_loadset);
52 static data1_att *getatt(data1_attset *p, int att)
56 for (; p; p = p->next)
59 for (a = p->atts; a; a = a->next)
62 /* scan included sets */
63 if (p->children && (a = getatt(p->children, att)))
69 attent *att_getentbyatt(oid_value set, int att)
80 for (p = registered_sets; p; p = p->next)
81 if (p->reference == set && (r = getatt(p, att)))
85 res.attset_ordinal = r->parent->ordinal;
86 res.local_attributes = r->locals;