2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: attribute.c,v $
7 * Revision 1.2 1995-11-15 19:13:07 adam
8 * Work on record management.
11 * This interface is used by other modules (the Z-server in particular)
12 * to normalize the attributes given in queries.
20 #include <d1_attset.h>
22 #include "attribute.h"
24 static int initialized = 0;
26 static data1_attset *registered_sets = 0;
28 static void att_loadset(const char *n, const char *name)
32 if (!(new = data1_read_attset((char*) name)))
34 logf(LOG_WARN|LOG_ERRNO, "%s", name);
37 new->next = registered_sets;
38 registered_sets = new;
42 static void load_atts()
44 res_trav(common_resource, "attset", att_loadset);
47 static data1_att *getatt(data1_attset *p, int att)
51 for (; p; p = p->next)
54 for (a = p->atts; a; a = a->next)
57 /* scan included sets */
58 if (p->children && (a = getatt(p->children, att)))
64 attent *att_getentbyatt(oid_value set, int att)
75 for (p = registered_sets; p; p = p->next)
76 if (p->reference == set && (r = getatt(p, att)))
80 res.attset_ordinal = r->parent->ordinal;
81 res.local_attribute = r->local;