error

Name

error -- print error message

Synopsis

#include <error.h>

void error (int status , int errnum , const char * format , ...);

Description

error() shall print a message to standard error.

error() shall build the message from the following elements in their specified order:

  1. the program name. If the application has provided a function named error_print_progname(), error() shall call this to supply the program name; otherwise, error() uses the content of the global variable program_name.

  2. the colon and space characters, then the result of using the printf-style format and the optional arguments.

  3. if errnum is nonzero, error() shall add the colon and space characters, then the result of strerror(errnum).

  4. a newline.

If status is nonzero, error() shall call exit(status).

See Also

err(), errx()