COMERR(3)

NAME
comerr() - prints error message and exits

SYNOPSIS
comerr(format,arg1,...,argn)
char *format;

DESCRIPTION
comerr() formats and prints a message on the error output stream. Part of the message is the last error encountered by the system while executing the process. comerr() begins its output with the current program name (as passed to it by exec() ) followed by a colon ":" and the detailed system error message. It then formats the user supplied format string and arguments in the form printf() would.

RETURNS
none
Rather than return, comerr() terminates the current process and exits with the system error number as the exit code.

EXAMPLES
if (( f = fileopen("file", "r")) == NULL)
	comerr("Cannot open file.\n");

On stderr it appears as:

prog_name: No such file or directory. Cannot open file.

SEE ALSO
comerrno(3), error(3), errmsg(3), error(3) geterrno(3), printf(3), format(3)

NOTES
comerr() attempts to find a line in the message file that corresponds to the system error number. If none can be found, or it has trouble finding or reading the file, it simply says: error #.