file.h
which contains definitions of the numerical values of the error codes
defined in the error table and a C source file
file.c
which should be compiled and linked with the executable.
The source file is a plain ASCII text file. A ``#'' in the source file is treated as a comment character, and all remaining text to the end of the source line will be ignored. The source file consists of the following declarations:
The name of the table is used to construct the name of a function
initialize_)
which must be called to register the error table the the
com_err(3)
library. A re-entrant (thread-safe) version called
initialize_
)
is also defined.
To maintain compatibility, new codes should be added to the end of an existing table, and codes should not be removed from tables.
test_err.et
:
# example error table source file
id "\$Id\$"
et test
prefix TEST
ec PERM, "Operation not permitted"
ec IO, "I/O error"
ec NOMEM, "Out of memory"
ec INVAL, "Invalid argument"
end
Compiling the source file
test_err.et
with
compile_et
will create a C header file
test_err.h
containing the enumerated type
test_error_number
with values TEST_PERM, TEST_IO, TEST_NOMEM and
TEST_INVAL, and a C source file
test_err.c
containing the
com_err(3)
initialisation function
initialize_test_error_table().