- if (code == CDECL_ENOMEM) {
- state->err.code = code;
- state->err.str = err_no_mem.str;
+ set_err(msg, &state->err);
+}
+
+/*
+ * Sets the library error to code; fmt is a printf-style string that may use
+ * up to one %s directive, to refer to arg.
+ */
+void cdecl__err(unsigned code, const char *fmt, const char *arg)
+{
+ struct err_state *state;
+ int rc, try = 0;
+
+ state = get_err_state();
+ if (!state)