Split error messages into separate files.
Update libbb.h, per suggestion from Vladimir, to include __attribute__((format (printf ...))) stuff -Erik
This commit is contained in:
@ -31,15 +31,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "libbb.h"
|
||||
|
||||
extern const char *applet_name;
|
||||
|
||||
static void verror_msg(const char *s, va_list p)
|
||||
{
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: ", applet_name);
|
||||
vfprintf(stderr, s, p);
|
||||
}
|
||||
|
||||
extern void error_msg(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
@ -50,45 +41,6 @@ extern void error_msg(const char *s, ...)
|
||||
putc('\n', stderr);
|
||||
}
|
||||
|
||||
extern void error_msg_and_die(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
|
||||
va_start(p, s);
|
||||
verror_msg(s, p);
|
||||
va_end(p);
|
||||
putc('\n', stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static void vperror_msg(const char *s, va_list p)
|
||||
{
|
||||
int err=errno;
|
||||
if(s == 0) s = "";
|
||||
verror_msg(s, p);
|
||||
if (*s) s = ": ";
|
||||
fprintf(stderr, "%s%s\n", s, strerror(err));
|
||||
}
|
||||
|
||||
extern void perror_msg(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
|
||||
va_start(p, s);
|
||||
vperror_msg(s, p);
|
||||
va_end(p);
|
||||
}
|
||||
|
||||
extern void perror_msg_and_die(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
|
||||
va_start(p, s);
|
||||
vperror_msg(s, p);
|
||||
va_end(p);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
/* END CODE */
|
||||
/*
|
||||
|
Reference in New Issue
Block a user