2001-03-20 00:54:06 +05:30
|
|
|
/* vi: set sw=4 ts=4: */
|
|
|
|
/*
|
|
|
|
* Utility routines.
|
|
|
|
*
|
2004-03-15 13:59:22 +05:30
|
|
|
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
2001-03-20 00:54:06 +05:30
|
|
|
*
|
2006-05-20 00:59:19 +05:30
|
|
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
2001-03-20 00:54:06 +05:30
|
|
|
*/
|
|
|
|
#include "libbb.h"
|
|
|
|
|
2008-06-27 08:22:20 +05:30
|
|
|
void FAST_FUNC bb_perror_msg(const char *s, ...)
|
2001-03-20 00:54:06 +05:30
|
|
|
{
|
|
|
|
va_list p;
|
|
|
|
|
|
|
|
va_start(p, s);
|
2007-08-03 19:46:24 +05:30
|
|
|
/* Guard against "<error message>: Success" */
|
2007-08-16 01:37:53 +05:30
|
|
|
bb_verror_msg(s, p, errno ? strerror(errno) : NULL);
|
2001-03-20 00:54:06 +05:30
|
|
|
va_end(p);
|
|
|
|
}
|
2007-10-01 17:28:38 +05:30
|
|
|
|
2010-07-04 20:46:44 +05:30
|
|
|
void FAST_FUNC bb_perror_msg_and_die(const char *s, ...)
|
|
|
|
{
|
|
|
|
va_list p;
|
|
|
|
|
|
|
|
va_start(p, s);
|
|
|
|
/* Guard against "<error message>: Success" */
|
|
|
|
bb_verror_msg(s, p, errno ? strerror(errno) : NULL);
|
|
|
|
va_end(p);
|
|
|
|
xfunc_die();
|
|
|
|
}
|
|
|
|
|
2008-06-27 08:22:20 +05:30
|
|
|
void FAST_FUNC bb_simple_perror_msg(const char *s)
|
2007-10-01 17:28:38 +05:30
|
|
|
{
|
|
|
|
bb_perror_msg("%s", s);
|
|
|
|
}
|
2010-07-04 20:46:44 +05:30
|
|
|
|
|
|
|
void FAST_FUNC bb_simple_perror_msg_and_die(const char *s)
|
|
|
|
{
|
|
|
|
bb_perror_msg_and_die("%s", s);
|
|
|
|
}
|