Пример #1
0
/**
 * Print an error message with a detailed description, and optionally exit.
 *
 * This is a GNU extension.
 *
 * @etymology  Report (error)!
 *
 * @param  status  The process will exit, with the function returning, with this
 *                 exit status, unless it is zero. If zero, the process shall not exit.
 * @param  errnum  The value of `errno` when the error occurred, zero if the a textual
 *                 description of the error, further than that of `format`, shall not
 *                 be printed.
 * @param  format  Formatting-string for a detailed description of what happend.
 * @param  args    Formatting-arguments for `format`.
 *
 * @since  Always.
 */
void error(int status, int errnum, const char* format, ...)
{
    va_list args;
    va_start(args, format);
    verror_at_line(status, errnum, NULL, 0, format, args);
    va_end(args);
}
Пример #2
0
/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
   if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
   If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
   Use the globals error_print_progname and error_message_count similarly
   to error().  */
void
verror (int status, int errnum, const char *format, va_list args)
{
  verror_at_line (status, errnum, NULL, 0, format, args);
}