err()

write formatted error message based on errno 

Function


SYNOPSIS

#include <err.h>

void err(int eval, const char *fmt, ...);


DESCRIPTION

The function err() writes a formatted error message to the standard error stream, and then exits with the specified value. The first part of the output line sent to standard error consists of the file name of the executable, followed by a colon and a space. If the value of fmt is not null, this is followed by a message containing the optional variables, formatted according to fmt, followed by a trailing colon and space. The last part of the message is the string associated with the current value of errno, followed by a linefeed.

The function err() is roughly equivalent to

fprintf(stderr, " %s: ", argv[0]);
fprintf(stderr, fmt, ...);
fprintf(stderr, ": %s\n", strerror(errno));
exit(eval);

PARAMETERS

eval 

Is the exit value for process.

fmt 

Is the format string for optional arguments, or the null pointer if no formatted message is to be instated.

... 

Represents optional arguments to the formatted message.


RETURN VALUES

The err() function never returns.


CONFORMANCE

4.4BSD.


MULTITHREAD SAFETY LEVEL

Unsafe.


PORTING ISSUES

None


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
errx(), exit(), fprintf(), perror(), strerror(), verr(), verrx(), vwarn(), vwarnx(), warn(), warnx()


PTC MKS Toolkit 10.3 Documentation Build 39.