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:
Eric Andersen
2001-03-19 19:24:06 +00:00
parent cc165b9083
commit b183dfad2d
10 changed files with 285 additions and 53 deletions

View File

@ -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 */
/*