Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/e/err.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/e/err.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/e/err.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/e/err.html on line 8
Display a formatted error message, and then exit
#include <err.h>
void err( int eval,
const char *fmt, ...);
void errx( int eval,
const char *fmt, ...);
- eval
- The value to use as the exit code of the process.
- fmt
- NULL, or a
printf()-style
string used to format the message.
- Additional arguments
- As required by the format string.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The err() and warn() family of functions display
a formatted error message on
stderr:
- The functions without an x in their names display the string
associated with the current value of
errno.
- Those with a v are “varargs” functions.
- Those with err exit instead of returning.
The err() function produces a message that consists of:
- the last component of the program name, followed by a colon and a space
- the formatted message, followed by a colon and a space, if the
fmt argument isn't NULL
- the string associated with the current value of errno
- a newline character.
The errx() function produces a similar message, except that it
doesn't include the string associated with errno.
The message consists of:
- the last component of the program name, followed by a colon and a space
- the formatted message, if the fmt argument isn't
NULL
- a newline character.
The err() and errx() functions don't return, but exit
with the value of the argument eval.
Display the current errno information string and exit:
if ((p = malloc(size)) == NULL)
err(1, NULL);
if ((fd = open(file_name, O_RDONLY, 0)) == -1)
err(1, "%s", file_name);
Display an error message and exit:
if (tm.tm_hour < START_TIME)
errx(1, "too early, wait until %s", start_time_string);
Unix
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
printf(),
stderr,
strerror(),
verr(),
verrx(),
vwarn(),
vwarnx(),
warn(),
warnx()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/e/err.html on line 289
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/e/err.html on line 289