diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-07 16:20:03 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-07 16:20:03 +0000 |
commit | a9801658ee4b7f5717d145818428452f864e1015 (patch) | |
tree | f85bbdf6cb572751dee639feb9896cad3503b924 /libbb | |
parent | b750dec40a4bf013f98658b46925117d9d1d4811 (diff) | |
download | busybox-a9801658ee4b7f5717d145818428452f864e1015.tar.gz |
getty, sulogin: convert to using bb_msg for syslog output
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/error_msg_and_die.c | 4 | ||||
-rw-r--r-- | libbb/fflush_stdout_and_exit.c | 2 | ||||
-rw-r--r-- | libbb/herror_msg_and_die.c | 2 | ||||
-rw-r--r-- | libbb/perror_msg_and_die.c | 2 | ||||
-rw-r--r-- | libbb/verror_msg.c | 5 | ||||
-rw-r--r-- | libbb/vinfo_msg.c | 2 | ||||
-rw-r--r-- | libbb/warn_ignoring_args.c | 2 | ||||
-rw-r--r-- | libbb/xfuncs.c | 3 |
8 files changed, 17 insertions, 5 deletions
diff --git a/libbb/error_msg_and_die.c b/libbb/error_msg_and_die.c index f25a1da32..29a260bde 100644 --- a/libbb/error_msg_and_die.c +++ b/libbb/error_msg_and_die.c @@ -13,6 +13,8 @@ #include <stdlib.h> #include "libbb.h" +int die_sleep; + void bb_error_msg_and_die(const char *s, ...) { va_list p; @@ -20,5 +22,7 @@ void bb_error_msg_and_die(const char *s, ...) va_start(p, s); bb_verror_msg(s, p, NULL); va_end(p); + if (die_sleep) + sleep(die_sleep); exit(bb_default_error_retval); } diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c index 7e8152dd6..245f50864 100644 --- a/libbb/fflush_stdout_and_exit.c +++ b/libbb/fflush_stdout_and_exit.c @@ -20,5 +20,7 @@ void bb_fflush_stdout_and_exit(int retval) if (fflush(stdout)) { retval = bb_default_error_retval; } + if (die_sleep) + sleep(die_sleep); exit(retval); } diff --git a/libbb/herror_msg_and_die.c b/libbb/herror_msg_and_die.c index 285b195ef..f115c8e0a 100644 --- a/libbb/herror_msg_and_die.c +++ b/libbb/herror_msg_and_die.c @@ -19,5 +19,7 @@ void bb_herror_msg_and_die(const char *s, ...) va_start(p, s); bb_vherror_msg(s, p); va_end(p); + if (die_sleep) + sleep(die_sleep); exit(bb_default_error_retval); } diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c index 5b0464077..c1cfb956f 100644 --- a/libbb/perror_msg_and_die.c +++ b/libbb/perror_msg_and_die.c @@ -20,5 +20,7 @@ void bb_perror_msg_and_die(const char *s, ...) va_start(p, s); bb_vperror_msg(s, p); va_end(p); + if (die_sleep) + sleep(die_sleep); exit(bb_default_error_retval); } diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c index d55da73ff..988a7a293 100644 --- a/libbb/verror_msg.c +++ b/libbb/verror_msg.c @@ -15,6 +15,7 @@ #include "libbb.h" int logmode = LOGMODE_STDIO; +const char *msg_eol = "\n"; void bb_verror_msg(const char *s, va_list p, const char* strerr) { @@ -28,9 +29,9 @@ void bb_verror_msg(const char *s, va_list p, const char* strerr) fprintf(stderr, "%s: ", bb_applet_name); vfprintf(stderr, s, p); if (!strerr) - fputc('\n', stderr); + fputs(msg_eol, stderr); else - fprintf(stderr, ": %s\n", strerr); + fprintf(stderr, ": %s%s", strerr, msg_eol); } if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG)) { if (!strerr) diff --git a/libbb/vinfo_msg.c b/libbb/vinfo_msg.c index 82fbda221..613b013cd 100644 --- a/libbb/vinfo_msg.c +++ b/libbb/vinfo_msg.c @@ -22,7 +22,7 @@ void bb_vinfo_msg(const char *s, va_list p) va_copy(p2, p); if (logmode & LOGMODE_STDIO) { vprintf(s, p); - putchar('\n'); + fputs(msg_eol, stdout); } if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG)) vsyslog(LOG_INFO, s, p2); diff --git a/libbb/warn_ignoring_args.c b/libbb/warn_ignoring_args.c index af82a6b5b..6405ff826 100644 --- a/libbb/warn_ignoring_args.c +++ b/libbb/warn_ignoring_args.c @@ -12,6 +12,6 @@ void bb_warn_ignoring_args(int n) { if (n) { - bb_perror_msg("ignoring all arguments"); + bb_error_msg("ignoring all arguments"); } } diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 435379de2..4bb05f248 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -408,7 +408,8 @@ char *xasprintf(const char *format, ...) void xprint_and_close_file(FILE *file) { // copyfd outputs error messages for us. - if (bb_copyfd_eof(fileno(file), 1) == -1) exit(bb_default_error_retval); + if (bb_copyfd_eof(fileno(file), 1) == -1) + exit(bb_default_error_retval); fclose(file); } |