# phpman > man > COM_ERR(3)

[COM_ERR(3)](https://www.chedong.com/phpMan.php/man/COMERR/3/markdown)                            Library Functions Manual                            [COM_ERR(3)](https://www.chedong.com/phpMan.php/man/COMERR/3/markdown)



## NAME
       com_err - common error display routine

## SYNOPSIS
        #include <et/com_err.h>
       void (*_proc_) (const char *, long, const char *, va_list);

       void com_err (const char *whoami, long code, const char *format, ...);

       proc = set_com_err_hook (proc);

       proc = reset_com_err_hook ();

       void initialize_XXXX_error_table ();

## DESCRIPTION
       _Com_err_  displays  an  error message on the standard error stream _stderr_ (see [_stdio_(3S)](https://www.chedong.com/phpMan.php/man/stdio/3S/markdown)) com‐
       posed of the _whoami_ string, which should specify the program name or  some  subportion  of  a
       program,  followed  by  an  error  message  generated  from the _code_ value (derived from _com__‐
       [_pile_et_(1)](https://www.chedong.com/phpMan.php/man/pileet/1/markdown)), and a string produced using the _format_ string and any  following  arguments,  in
       the same style as [_fprintf_(3)](https://www.chedong.com/phpMan.php/man/fprintf/3/markdown).

       The  behavior  of  _com_err_  can  be modified using _set_com_err_hook;_ this defines a procedure
       which is called with the arguments passed to _com_err,_ instead of the default internal  proce‐
       dure  which sends the formatted text to error output.  Thus the error messages from a program
       can all easily be diverted to another form of diagnostic logging,  such  as  [_syslog_(3)](https://www.chedong.com/phpMan.php/man/syslog/3/markdown).   _Re__‐
       _set_com_err_hook_  may  be  used to restore the behavior of _com_err_ to its default form.  Both
       procedures return the previous ``hook'' value.  These ``hook'' procedures must have the  dec‐
       laration given for _proc_ above in the synopsis.

       The  _initialize_XXXX_error_table_  routine  is  generated mechanically by [_compile_et_(1)](https://www.chedong.com/phpMan.php/man/compileet/1/markdown) from a
       source file containing names and associated strings.  Each table has a name  of  up  to  four
       characters,  which  is  used in place of the **XXXX** in the name of the routine.  These routines
       should be called before any of the corresponding error codes are used, so  that  the  _com_err_
       library will recognize error codes from these tables when they are used.

       The  **com**___**err.h**  header file should be included in any source file that uses routines from the
       _com_err_ library; executable files must be linked using _``-lcom_err''_ in order  to  cause  the
       _com_err_ library to be included.



## SEE ALSO
       compile_et (1), syslog (3).

       Ken Raeburn, "A Common Error Description Library for UNIX".



SIPB                                         22 Nov 1988                                  [COM_ERR(3)](https://www.chedong.com/phpMan.php/man/COMERR/3/markdown)
