1COM_ERR(3)                 Library Functions Manual                 COM_ERR(3)
2
3
4

NAME

6       com_err - common error display routine
7

SYNOPSIS

9        #include <et/com_err.h>
10       void (*proc) (const char *, long, const char *, va_list);
11
12       void com_err (const char *whoami, long code, const char *format, ...);
13
14       proc = set_com_err_hook (proc);
15
16       proc = reset_com_err_hook ();
17
18       void initialize_XXXX_error_table ();
19

DESCRIPTION

21       Com_err  displays  an error message on the standard error stream stderr
22       (see stdio(3S)) composed of the whoami string, which should specify the
23       program name or some subportion of a program, followed by an error mes‐
24       sage generated from the code value (derived from compile_et(1)), and  a
25       string produced using the format string and any following arguments, in
26       the same style as fprintf(3).
27
28       The behavior of com_err can be modified  using  set_com_err_hook;  this
29       defines  a  procedure  which  is  called  with  the arguments passed to
30       com_err, instead of the default internal procedure which sends the for‐
31       matted  text  to  error output.  Thus the error messages from a program
32       can all easily be diverted to another form of diagnostic logging,  such
33       as  syslog(3).   Reset_com_err_hook may be used to restore the behavior
34       of com_err to its default form.  Both procedures  return  the  previous
35       ``hook''  value.   These  ``hook'' procedures must have the declaration
36       given for proc above in the synopsis.
37
38       The initialize_XXXX_error_table routine is  generated  mechanically  by
39       compile_et(1)  from  a  source  file  containing  names  and associated
40       strings.  Each table has a name of up to four characters, which is used
41       in place of the XXXX in the name of the routine.  These routines should
42       be called before any of the corresponding error codes are used, so that
43       the  com_err  library will recognize error codes from these tables when
44       they are used.
45
46       The com_err.h header file should be included in any  source  file  that
47       uses routines from the com_err library; executable files must be linked
48       using ``-lcom_err'' in  order  to  cause  the  com_err  library  to  be
49       included.
50
51
52

SEE ALSO

54       compile_et (1), syslog (3).
55
56       Ken Raeburn, "A Common Error Description Library for UNIX".
57
58
59
60SIPB                              22 Nov 1988                       COM_ERR(3)
Impressum