+ return !!str;
+}
+
+int
+sprintxval_ex(char *const buf, const size_t size, const struct xlat *const x,
+ const unsigned int val, const char *const dflt,
+ enum xlat_style style)
+{
+ style = get_xlat_style(style);
+
+ if (xlat_verbose(style) == XLAT_STYLE_RAW)
+ return xsnprintf(buf, size, "%s", sprint_xlat_val(val, style));
+
+ const char *const str = xlookup(x, val);
+
+ if (str) {
+ if (xlat_verbose(style) == XLAT_STYLE_VERBOSE)
+ return xsnprintf(buf, size, "%s /* %s */",
+ sprint_xlat_val(val, style), str);
+ else
+ return xsnprintf(buf, size, "%s", str);
+ }
+ if (dflt)
+ return xsnprintf(buf, size, "%s /* %s */",
+ sprint_xlat_val(val, style), dflt);
+
+ return xsnprintf(buf, size, "%s", sprint_xlat_val(val, style));