This is simpler than having duplicate code throughout the
source.
DICT_ATTR *dict_attrbyname(const char *attr);
DICT_VALUE *dict_valbyattr(unsigned int attr, unsigned int vendor, int val);
DICT_VALUE *dict_valbyname(unsigned int attr, unsigned int vendor, const char *val);
+const char *dict_valnamebyattr(unsigned int attr, unsigned int vendor, int value);
int dict_vendorbyname(const char *name);
DICT_VENDOR *dict_vendorbyvalue(int vendor);
}
/*
+ * Associate a value with an attribute and return it.
+ */
+const char *dict_valnamebyattr(unsigned int attr, unsigned int vendor, int value)
+{
+ DICT_VALUE *dv;
+
+ dv = dict_valbyattr(attr, vendor, value);
+ if (!dv) return "";
+
+ return dv->name;
+}
+
+/*
* Get a value by its name, keyed off of an attribute.
*/
DICT_VALUE *dict_valbyname(unsigned int attr, unsigned int vendor, const char *name)