source: trunk/third/moira/util/et/com_err.3 @ 23740

Revision 23740, 2.5 KB checked in by broder, 15 years ago (diff)
In moira: * New CVS snapshot (Trac: #195) * Drop patches that have been incorporated upstream. * Update to build without krb4 on systems that no longer have it. This doesn't build yet on squeeze, which lacks a krb4 library, but I'm committing now before I start hacking away at a patch to fix that.
Line 
1.\" Copyright (c) 1988 Massachusetts Institute of Technology,
2.\" Student Information Processing Board.  All rights reserved.
3.\"
4.\" $Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/util/et/com_err.3,v 1.2 1998-02-05 22:13:00 danw Exp $
5.\"
6.TH COM_ERR 3 "22 Nov 1988" SIPB
7.SH NAME
8com_err \- common error display routine
9.SH SYNOPSIS
10.nf
11 #include <com_err.h>
12.PP
13void com_err (whoami, code, format, ...);
14        const char *whoami;
15        long code;
16        const char *format;
17.PP
18proc = set_com_err_hook (proc);
19.fi
20void (*
21.I proc
22) (const char *, long, const char *, va_list);
23.nf
24.PP
25proc = reset_com_err_hook ();
26.PP
27void initialize_XXXX_error_table ();
28.fi
29.SH DESCRIPTION
30.I Com_err
31displays an error message on the standard error stream
32.I stderr
33(see
34.IR stdio (3S))
35composed of the
36.I whoami
37string, which should specify the program name or some subportion of
38a program, followed by an error message generated from the
39.I code
40value (derived from
41.IR compile_et (1)),
42and a string produced using the
43.I format
44string and any following arguments, in the same style as
45.IR fprintf (3).
46
47The behavior of
48.I com_err
49can be modified using
50.I set_com_err_hook;
51this defines a procedure which is called with the arguments passed to
52.I com_err,
53instead of the default internal procedure which sends the formatted
54text to error output.  Thus the error messages from a program can all
55easily be diverted to another form of diagnostic logging, such as
56.IR syslog (3).
57.I Reset_com_err_hook
58may be used to restore the behavior of
59.I com_err
60to its default form.  Both procedures return the previous ``hook''
61value.  These ``hook'' procedures must have the declaration given for
62.I proc
63above in the synopsis.
64
65The
66.I initialize_XXXX_error_table
67routine is generated mechanically by
68.IR compile_et (1)
69from a source file containing names and associated strings.  Each
70table has a name of up to four characters, which is used in place of
71the
72.B XXXX
73in the name of the routine.  These routines should be called before
74any of the corresponding error codes are used, so that the
75.I com_err
76library will recognize error codes from these tables when they are
77used.
78
79The
80.B com_err.h
81header file should be included in any source file that uses routines
82from the
83.I com_err
84library; executable files must be linked using
85.I ``-lcom_err''
86in order to cause the
87.I com_err
88library to be included.
89
90.\" .IR for manual entries
91.\" .PP for paragraph breaks
92
93.SH "SEE ALSO"
94compile_et (1), syslog (3).
95
96Ken Raeburn, "A Common Error Description Library for UNIX".
Note: See TracBrowser for help on using the repository browser.