summaryrefslogtreecommitdiff
path: root/usr.bin/compile_et/compile_et.1
blob: cc493149ffadeb9ad2e0e02b73589ec59aebcb08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.\" Copyright (c) 1988 Massachusetts Institute of Technology,
.\" Student Information Processing Board.  All rights reserved.
.\"
.\" $OpenBSD: compile_et.1,v 1.13 2004/04/03 21:43:36 jmc Exp $
.\" $Header: /cvs/OpenBSD/src/usr.bin/compile_et/compile_et.1,v 1.13 2004/04/03 21:43:36 jmc Exp $
.\"
.Dd November 22, 1988
.Dt COMPILE_ET 1
.Os
.Sh NAME
.Nm compile_et
.Nd error table compiler
.Sh SYNOPSIS
.Nm compile_et
.Ar file
.Sh DESCRIPTION
.Nm
converts a table listing error-code names and associated messages into
a C source file suitable for use with the
.Xr com_err 3
library.
.Pp
The source file name must end with a suffix of
.Dq .et ;
the file
consists of headers and declarations supplying the name (up to four characters
long) of the error-code table.
.Pp
The file may have these declarations:
.Bl -tag -width Ds
.It Sy id Ar string
Specify
.Ar string
as a revision control system tag.
.It Sy prefix Ar string
Prepends
.Ar string
to all error codes specified in the file.
.It Sy error_table Ar name
Specifies the name of the error table.
.It Sy index Ar number
Sets the assigned error number for the next entry.
.It Xo Sy error_code
.Ar name ,
.Qq Ar string
.Xc
Declares an error code called
.Ar name
with description
.Ar string ;
up to 256 error codes are allowed.
.It Sy end
Indicates the end of the table.
.El
.Pp
The name of the table is used to construct the name of a subroutine
.Em initialize_XXXX_error_table
which must be called in order for the
.Xr com_err 3
library to recognize the error table.
.Pp
The various error codes defined are assigned sequentially increasing
numbers (starting with a large number computed as a hash function of
the name of the table); thus for compatibility it is suggested that
new codes be added only to the end of an existing table, and that no
codes be removed from tables.
.Pp
The names defined in the table are placed into a C header file with
preprocessor directives defining them as integer constants of up to
32 bits in magnitude.
.Pp
A C source file is also generated which should be compiled and linked
with the object files which reference these error codes; it contains
the text of the messages and the initialization subroutine.
Both C files have names derived from that of the original source file, with
the
.Dq .et
suffix replaced by
.Dq \&.c
and
.Dq \&.h .
.Pp
A hash mark
.Pq Ql #
in the source file is treated as a comment character; subsequent
characters to the end of the source line will be ignored.
.Sh SEE ALSO
.Xr yacc 1 ,
.Xr com_err 3
.Rs
.%A Ken Raeburn
.%T "A Common Error Description Library for UNIX"
.Re
.Sh BUGS
Since
.Nm
uses a very simple parser based on
.Xr yacc 1 ,
its error recovery leaves much to be desired.