compile_et(1) - NetBSD Manual Pages

Command: Section: Arch: Collection:  
COMPILE_ET(1)           NetBSD General Commands Manual           COMPILE_ET(1)

compile_et -- error table compiler
compile_et [--version] [--help] file
The compile_et utility reads the table describing error-code names and their associated messages in the file file and generates a C source file suitable for use with the com_err(3) library. The source file file must end with a suffix of ``.et'' and compile_et writes a C header file 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 follow- ing declarations: id [base] string Defines an identification string (such a a version string) which is recorded in the generated files. It is mandatory and must be the first declaration in the source file. et name Specifies the name of the error table to be name. It is mandatory and must be declared after the id declaration and before all other declarations. The name of table is lim- ited to four ASCII characters. The optional argument base specifies the base value of error codes the table. The name of the table is used to construct the name of a function initialize_<name>_error_table() which must be called to register the error table the the com_err(3) library. A re-entrant (thread-safe) version called initialize_<name>_error_table_r() is also defined. prefix [string] Defines a prefix to be applied to all error code names. If no string is specified, the prefix is not defined. It is an optional declaration and can appear more than once. index val Specifies the index val in the error table for the follow- ing error code declaration. Subsequent error codes are allocated sequentially from the same value. It is an optional declaration and can appear more than once. ec cname, msg Defines an error code with the name cname and its associ- ated error message msg. The error codes are assigned sequentially increasing numbers. The name is placed into the C header file as an enumerated type. end Indicates the end of the error table. To maintain compatibility, new codes should be added to the end of an existing table, and codes should not be removed from tables.
A short sample error table might be # 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 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().
com_err(3) NetBSD 4.0 November 9, 2001 NetBSD 4.0
Powered by man-cgi (2021-06-01). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.