-static int attr_find_ex(AttrType *src, oid_value *attributeSetP,
- const char **string_value)
-{
- int num_attributes;
-
- num_attributes = src->zapt->attributes->num_attributes;
- while (src->major < num_attributes)
- {
- Z_AttributeElement *element;
-
- element = src->zapt->attributes->attributes[src->major];
- if (src->type == *element->attributeType)
- {
- switch (element->which)
- {
- case Z_AttributeValue_numeric:
- ++(src->major);
- if (element->attributeSet && attributeSetP)
- {
- oident *attrset;
-
- attrset = oid_getentbyoid(element->attributeSet);
- *attributeSetP = attrset->value;
- }
- return *element->value.numeric;
- break;
- case Z_AttributeValue_complex:
- if (src->minor >= element->value.complex->num_list)
- break;
- if (element->attributeSet && attributeSetP)
- {
- oident *attrset;
-
- attrset = oid_getentbyoid(element->attributeSet);
- *attributeSetP = attrset->value;
- }
- if (element->value.complex->list[src->minor]->which ==
- Z_StringOrNumeric_numeric)
- {
- ++(src->minor);
- return
- *element->value.complex->list[src->minor-1]->u.numeric;
- }
- else if (element->value.complex->list[src->minor]->which ==
- Z_StringOrNumeric_string)
- {
- if (!string_value)
- break;
- ++(src->minor);
- *string_value =
- element->value.complex->list[src->minor-1]->u.string;
- return -2;
- }
- else
- break;
- default:
- assert(0);
- }
- }
- ++(src->major);
- }
- return -1;
-}
-
-static int attr_find(AttrType *src, oid_value *attributeSetP)
-{
- return attr_find_ex(src, attributeSetP, 0);
-}
-
-static void attr_init(AttrType *src, Z_AttributesPlusTerm *zapt,
- int type)
-{
- src->zapt = zapt;
- src->type = type;
- src->major = 0;
- src->minor = 0;
-}
-