This function allows programs to pass in a pointer to the gettext
function so that error table strings will can be internationalized.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
extern void (*reset_com_err_hook (void)) (const char *, long,
const char *, va_list);
extern int init_error_table(const char * const *msgs, long base, int count);
+extern char *(*set_com_err_gettext (char *(*) (const char *)))
+ (const char *);
extern errcode_t add_error_table(const struct error_table * et);
extern errcode_t remove_error_table(const struct error_table * et);
return 0;
}
+typedef char *(*gettextf) (const char *);
+
+gettextf com_err_gettext = NULL;
+
+gettextf set_com_err_gettext (new_proc)
+ gettextf new_proc;
+{
+ gettextf x = com_err_gettext;
+
+ com_err_gettext = new_proc;
+
+ return x;
+}
+
+
const char * error_message (errcode_t code)
{
int offset;
} else {
const char *msg = et->table->msgs[offset];
et_list_unlock();
- return msg;
+ if (com_err_gettext)
+ return (*com_err_gettext)(msg);
+ else
+ return msg;
}
}
}
} else {
const char *msg = et->table->msgs[offset];
et_list_unlock();
- return msg;
+ if (com_err_gettext)
+ return (*com_err_gettext)(msg);
+ else
+ return msg;
}
}
}