2 * Copyright 1987, 1988 by MIT Student Information Processing Board.
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose is hereby granted, provided that
6 * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
7 * advertising or publicity pertaining to distribution of the software
8 * without specific, written prior permission. M.I.T. and the
9 * M.I.T. S.I.P.B. make no representations about the suitability of
10 * this software for any purpose. It is provided "as is" without
11 * express or implied warranty.
16 #include "error_table.h"
20 default_com_err_proc (const char *whoami, errcode_t code, const
21 char *fmt, va_list args)
22 COM_ERR_ATTR((format(printf, 3, 0)));
25 default_com_err_proc (const char *whoami, errcode_t code, const
26 char *fmt, va_list args)
29 fputs(whoami, stderr);
33 fputs(error_message(code), stderr);
37 vfprintf (stderr, fmt, args);
39 /* should output \r only if using a tty in raw mode */
40 fputs("\r\n", stderr);
44 typedef void (*errf) (const char *, errcode_t, const char *, va_list);
46 errf com_err_hook = default_com_err_proc;
48 void com_err_va (const char *whoami, errcode_t code, const char *fmt,
51 (*com_err_hook) (whoami, code, fmt, args);
54 void com_err (const char *whoami,
61 com_err_hook = default_com_err_proc;
63 com_err_va (whoami, code, fmt, pvar);
67 errf set_com_err_hook (new_proc)
70 errf x = com_err_hook;
73 com_err_hook = new_proc;
75 com_err_hook = default_com_err_proc;
80 errf reset_com_err_hook () {
81 errf x = com_err_hook;
82 com_err_hook = default_com_err_proc;