tests: add error_msg_and_fail function to libtests
* tests/tests.h (error_msg_and_fail): New prototype. * tests/error_msg.c (error_msg_and_fail): New function.
This commit is contained in:
parent
d44707d889
commit
3d54c92691
@ -47,6 +47,17 @@ perror_msg_and_fail(const char *fmt, ...)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
error_msg_and_fail(const char *fmt, ...)
|
||||
{
|
||||
va_list p;
|
||||
|
||||
va_start(p, fmt);
|
||||
vfprintf(stderr, fmt, p);
|
||||
putc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
error_msg_and_skip(const char *fmt, ...)
|
||||
{
|
||||
|
@ -41,6 +41,9 @@ size_t get_page_size(void);
|
||||
/* Print message and strerror(errno) to stderr, then exit(1). */
|
||||
void perror_msg_and_fail(const char *, ...)
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
|
||||
/* Print message to stderr, then exit(1). */
|
||||
void error_msg_and_fail(const char *, ...)
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
|
||||
/* Print message to stderr, then exit(77). */
|
||||
void error_msg_and_skip(const char *, ...)
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
|
||||
|
Loading…
Reference in New Issue
Block a user