blob: fa1f0d3398f087b7cde0b4c56dffa06e6e65b678 [file] [log] [blame]
Eric Andersenb183dfa2001-03-19 19:24:06 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Utility routines.
4 *
Eric Andersenc7bda1c2004-03-15 08:29:22 +00005 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
Eric Andersenb183dfa2001-03-19 19:24:06 +00006 *
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02007 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
Eric Andersenb183dfa2001-03-19 19:24:06 +00008 */
Eric Andersenb183dfa2001-03-19 19:24:06 +00009#include "libbb.h"
10
Denis Vlasenkodefc1ea2008-06-27 02:52:20 +000011void FAST_FUNC bb_perror_msg(const char *s, ...)
Eric Andersenb183dfa2001-03-19 19:24:06 +000012{
13 va_list p;
14
15 va_start(p, s);
Denis Vlasenko0e2c9fb2007-08-03 14:16:24 +000016 /* Guard against "<error message>: Success" */
Denis Vlasenkoab9c44b2007-08-15 20:07:53 +000017 bb_verror_msg(s, p, errno ? strerror(errno) : NULL);
Eric Andersenb183dfa2001-03-19 19:24:06 +000018 va_end(p);
19}
Denis Vlasenko0c97c9d2007-10-01 11:58:38 +000020
Denys Vlasenko7e1bb4b2010-07-04 17:16:44 +020021void FAST_FUNC bb_perror_msg_and_die(const char *s, ...)
22{
23 va_list p;
24
25 va_start(p, s);
26 /* Guard against "<error message>: Success" */
27 bb_verror_msg(s, p, errno ? strerror(errno) : NULL);
28 va_end(p);
29 xfunc_die();
30}
31
Denis Vlasenkodefc1ea2008-06-27 02:52:20 +000032void FAST_FUNC bb_simple_perror_msg(const char *s)
Denis Vlasenko0c97c9d2007-10-01 11:58:38 +000033{
34 bb_perror_msg("%s", s);
35}
Denys Vlasenko7e1bb4b2010-07-04 17:16:44 +020036
37void FAST_FUNC bb_simple_perror_msg_and_die(const char *s)
38{
39 bb_perror_msg_and_die("%s", s);
40}