29
31
static bool errmsg_has= false;
31
static void add_errmsg_handler(Error_message_handler *handler)
33
void add_errmsg_handler(Error_message_handler *handler)
33
35
all_errmsg_handler.push_back(handler);
36
static void remove_errmsg_handler(Error_message_handler *handler)
39
void remove_errmsg_handler(Error_message_handler *handler)
38
41
all_errmsg_handler.erase(find(all_errmsg_handler.begin(),
39
42
all_errmsg_handler.end(), handler));
42
int errmsg_initializer(st_plugin_int *plugin)
44
Error_message_handler *p;
46
if (plugin->plugin->init)
48
if (plugin->plugin->init(&p))
50
/* we're doing the errmsg plugin api,
51
so we can't trust the errmsg api to emit our error messages
52
so we will emit error messages to stderr */
53
/* TRANSLATORS: The leading word "errmsg" is the name
54
of the plugin api, and so should not be translated. */
56
_("errmsg plugin '%s' init() failed."),
62
add_errmsg_handler(p);
70
int errmsg_finalizer(st_plugin_int *plugin)
72
Error_message_handler *p= static_cast<Error_message_handler *>(plugin->data);
74
remove_errmsg_handler(p);
75
if (plugin->plugin->deinit)
77
if (plugin->plugin->deinit(p))
79
/* we're doing the errmsg plugin api,
80
so we can't trust the errmsg api to emit our error messages
81
so we will emit error messages to stderr */
82
/* TRANSLATORS: The leading word "errmsg" is the name
83
of the plugin api, and so should not be translated. */
85
_("errmsg plugin '%s' deinit() failed."),
94
46
class ErrorMessagePrint : public unary_function<Error_message_handler *, bool>