2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: attribute.c,v $
7 * Revision 1.3 1996-05-09 07:28:54 quinn
8 * Work towards phrases and multiple registers
10 * Revision 1.2 1995/11/15 19:13:07 adam
11 * Work on record management.
14 * This interface is used by other modules (the Z-server in particular)
15 * to normalize the attributes given in queries.
23 #include <d1_attset.h>
25 #include "attribute.h"
27 static int initialized = 0;
29 static data1_attset *registered_sets = 0;
31 static void att_loadset(const char *n, const char *name)
35 if (!(new = data1_read_attset((char*) name)))
37 logf(LOG_WARN|LOG_ERRNO, "%s", name);
40 new->next = registered_sets;
41 registered_sets = new;
45 static void load_atts()
47 res_trav(common_resource, "attset", att_loadset);
50 static data1_att *getatt(data1_attset *p, int att)
54 for (; p; p = p->next)
57 for (a = p->atts; a; a = a->next)
60 /* scan included sets */
61 if (p->children && (a = getatt(p->children, att)))
67 attent *att_getentbyatt(oid_value set, int att)
78 for (p = registered_sets; p; p = p->next)
79 if (p->reference == set && (r = getatt(p, att)))
83 res.attset_ordinal = r->parent->ordinal;
84 res.local_attributes = r->locals;