diff -urpN busybox.0/include/libbb.h busybox.1/include/libbb.h
--- busybox.0/include/libbb.h	2006-09-03 17:45:14.000000000 +0200
+++ busybox.1/include/libbb.h	2006-09-04 01:27:36.000000000 +0200
@@ -112,6 +112,14 @@ extern void *llist_pop(llist_t **elm);
 extern void llist_free(llist_t *elm, void (*freeit)(void *data));
 
 
+enum {
+	LOGMODE_STDIO = 1<<0,
+	LOGMODE_SYSLOG = 1<<1,
+	LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO,
+	LOGMODE_PID = 1<<2
+};
+extern int bb_logmode;
+
 extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
 extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
 extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
@@ -124,9 +132,12 @@ extern void bb_herror_msg_and_die(const 
 extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
 extern void bb_perror_nomsg(void);
 
+extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
+
 /* These two are used internally -- you shouldn't need to use them */
-extern void bb_verror_msg(const char *s, va_list p) __attribute__ ((format (printf, 1, 0)));
+extern void bb_verror_msg(const char *s, va_list p, const char *strerr) __attribute__ ((format (printf, 1, 0)));
 extern void bb_vperror_msg(const char *s, va_list p)  __attribute__ ((format (printf, 1, 0)));
+extern void bb_vinfo_msg(const char *s, va_list p) __attribute__ ((format (printf, 1, 0)));
 
 extern int bb_echo(int argc, char** argv);
 extern int bb_test(int argc, char** argv);
diff -urpN busybox.0/libbb/error_msg_and_die.c busybox.1/libbb/error_msg_and_die.c
--- busybox.0/libbb/error_msg_and_die.c	2006-08-24 11:43:56.000000000 +0200
+++ busybox.1/libbb/error_msg_and_die.c	2006-09-04 00:06:43.000000000 +0200
@@ -18,8 +18,7 @@ void bb_error_msg_and_die(const char *s,
 	va_list p;
 
 	va_start(p, s);
-	bb_verror_msg(s, p);
+	bb_verror_msg(s, p, NULL);
 	va_end(p);
-	putc('\n', stderr);
 	exit(bb_default_error_retval);
 }
diff -urpN busybox.0/libbb/error_msg.c busybox.1/libbb/error_msg.c
--- busybox.0/libbb/error_msg.c	2006-08-24 11:43:56.000000000 +0200
+++ busybox.1/libbb/error_msg.c	2006-09-04 00:09:03.000000000 +0200
@@ -18,7 +18,6 @@ void bb_error_msg(const char *s, ...)
 	va_list p;
 
 	va_start(p, s);
-	bb_verror_msg(s, p);
+	bb_verror_msg(s, p, NULL);
 	va_end(p);
-	putc('\n', stderr);
 }
diff -urpN busybox.0/libbb/info_msg.c busybox.1/libbb/info_msg.c
--- busybox.0/libbb/info_msg.c	1970-01-01 01:00:00.000000000 +0100
+++ busybox.1/libbb/info_msg.c	2006-09-04 00:33:52.000000000 +0200
@@ -0,0 +1,23 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Utility routines.
+ *
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include "libbb.h"
+
+void bb_info_msg(const char *s, ...)
+{
+	va_list p;
+
+	va_start(p, s);
+	bb_vinfo_msg(s, p);
+	va_end(p);
+}
diff -urpN busybox.0/libbb/Makefile.in busybox.1/libbb/Makefile.in
--- busybox.0/libbb/Makefile.in	2006-09-03 17:45:14.000000000 +0200
+++ busybox.1/libbb/Makefile.in	2006-09-04 01:27:36.000000000 +0200
@@ -28,6 +28,7 @@ LIBBB-y:= \
 	restricted_shell.c run_parts.c run_shell.c safe_read.c safe_write.c \
 	safe_strncpy.c setup_environment.c sha1.c simplify_path.c \
 	trim.c u_signal_names.c vdprintf.c verror_msg.c \
+	info_msg.c vinfo_msg.c \
 	vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c xstat.c \
 	xgethostbyname.c xgethostbyname2.c xreadlink.c xgetlarg.c \
 	get_terminal_width_height.c fclose_nonstdin.c fflush_stdout_and_exit.c \
diff -urpN busybox.0/libbb/verror_msg.c busybox.1/libbb/verror_msg.c
--- busybox.0/libbb/verror_msg.c	2006-08-24 11:43:56.000000000 +0200
+++ busybox.1/libbb/verror_msg.c	2006-09-04 20:06:38.000000000 +0200
@@ -11,11 +11,55 @@
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
+#include <syslog.h>
 #include "libbb.h"
 
-void bb_verror_msg(const char *s, va_list p)
+int bb_logmode = LOGMODE_STDIO;
+
+void bb_verror_msg(const char *s, va_list p, const char* strerr)
 {
-	fflush(stdout);
-	fprintf(stderr, "%s: ", bb_applet_name);
-	vfprintf(stderr, s, p);
+	char *msg;
+	/* va_copy is used because it is not portable
+	 * to use va_list p twice */
+	va_list p2;
+	va_copy(p2, p);
+
+	/* bb_error_xx support */
+	if (!strerr || !*strerr) {
+		if (bb_logmode & LOGMODE_STDIO) {
+			fflush(stdout);
+			fprintf(stderr, "%s: ", bb_applet_name);
+			vfprintf(stderr, s, p);
+			fputc('\n', stderr);
+		}
+		if (bb_logmode & LOGMODE_SYSLOG) {
+			vsyslog(LOG_ERR, s, p2);
+		}
+		goto end;
+	}
+
+	/* bb_perror_xx support */
+	if (bb_logmode & LOGMODE_STDIO) {
+		fflush(stdout);
+		fprintf(stderr, "%s: ", bb_applet_name);
+		msg = "";
+		if (s && *s) {
+			vfprintf(stderr, s, p);
+			msg = ": ";
+		}
+		fprintf(stderr, "%s%s\n", msg, strerr);
+	}
+	if (bb_logmode & LOGMODE_SYSLOG) {
+		if (s && *s) {
+			/* xasprintf must not call bb_perror
+			 * or it will recurse! */
+			msg = xasprintf(s, p2);
+			syslog(LOG_ERR, "%s: %s", msg, strerr);
+			free(msg);
+		} else {
+			syslog(LOG_ERR, "%s", strerr);
+		}
+	}
+end:
+	va_end(p2);
 }
diff -urpN busybox.0/libbb/vherror_msg.c busybox.1/libbb/vherror_msg.c
--- busybox.0/libbb/vherror_msg.c	2006-08-24 11:43:56.000000000 +0200
+++ busybox.1/libbb/vherror_msg.c	2006-09-04 00:06:27.000000000 +0200
@@ -16,10 +16,5 @@
 
 void bb_vherror_msg(const char *s, va_list p)
 {
-	if(s == 0)
-		s = "";
-	bb_verror_msg(s, p);
-	if (*s)
-		fputs(": ", stderr);
-	herror("");
+	bb_verror_msg(s, p, hstrerror(h_errno));
 }
diff -urpN busybox.0/libbb/vinfo_msg.c busybox.1/libbb/vinfo_msg.c
--- busybox.0/libbb/vinfo_msg.c	1970-01-01 01:00:00.000000000 +0100
+++ busybox.1/libbb/vinfo_msg.c	2006-09-04 01:27:36.000000000 +0200
@@ -0,0 +1,25 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Utility routines.
+ *
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include "libbb.h"
+
+void bb_vinfo_msg(const char *s, va_list p)
+{
+	if (bb_logmode & LOGMODE_STDIO) {
+		vprintf(s, p);
+		putchar('\n');
+	}
+	if (bb_logmode & LOGMODE_SYSLOG)
+		vsyslog(LOG_INFO, s, p);
+}
diff -urpN busybox.0/libbb/vperror_msg.c busybox.1/libbb/vperror_msg.c
--- busybox.0/libbb/vperror_msg.c	2006-08-24 11:43:56.000000000 +0200
+++ busybox.1/libbb/vperror_msg.c	2006-09-04 00:08:20.000000000 +0200
@@ -15,9 +15,5 @@
 
 void bb_vperror_msg(const char *s, va_list p)
 {
-	int err=errno;
-	if(s == 0) s = "";
-	bb_verror_msg(s, p);
-	if (*s) s = ": ";
-	fprintf(stderr, "%s%s\n", s, strerror(err));
+	bb_verror_msg(s, p, strerror(errno));
 }
diff -urpN busybox.0/libbb/xfuncs.c busybox.1/libbb/xfuncs.c
--- busybox.0/libbb/xfuncs.c	2006-09-03 14:20:01.000000000 +0200
+++ busybox.1/libbb/xfuncs.c	2006-09-04 02:28:35.000000000 +0200
@@ -374,7 +374,8 @@ off_t fdlength(int fd)
 
 #ifdef L_xasprintf
 /* Die with an error message if we can't malloc() enough space and do an
- * sprintf() into that space. */
+ * sprintf() into that space.
+ * Do not use bb_perror_xx here or you will recurse! */
 char *xasprintf(const char *format, ...)
 {
 	va_list p;
@@ -397,7 +398,7 @@ char *xasprintf(const char *format, ...)
 	va_end(p);
 #endif
 
-	if (r < 0) bb_perror_msg_and_die("xasprintf");
+	if (r < 0) bb_error_msg_and_die(bb_msg_memory_exhausted);
 	return string_ptr;
 }
 #endif
diff -urpN busybox.0/networking/nameif.c busybox.1/networking/nameif.c
--- busybox.0/networking/nameif.c	2006-08-24 11:43:51.000000000 +0200
+++ busybox.1/networking/nameif.c	2006-09-04 00:32:55.000000000 +0200
@@ -56,8 +56,7 @@ static void serror(const char *s, ...)
 		vsyslog(LOG_ERR, s, ap);
 		closelog();
 	} else {
-		bb_verror_msg(s, ap);
-		putc('\n', stderr);
+		bb_verror_msg(s, ap, NULL);
 	}
 	va_end(ap);
 
