Try to make indent formatting less horrible
[oweals/busybox.git] / sysklogd / klogd.c
index 710bd5a31b7ae9067f787e6e5b9d1b26ccb21b76..c132e065cc4058c23c0924cd9a5afbf7a10e5b55 100644 (file)
@@ -2,18 +2,17 @@
 /*
  * Mini klogd implementation for busybox
  *
- * Copyright (C) 2001 by Gennady Feldman <gfeldman@cachier.com>.
+ * Copyright (C) 2001 by Gennady Feldman <gfeldman@gena01.com>.
  * Changes: Made this a standalone busybox module which uses standalone
  *                                     syslog() client interface.
  *
- * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
+ * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
  *
  * Copyright (C) 2000 by Karl M. Hegbloom <karlheg@debian.org>
  *
- * "circular buffer" Copyright (C) 2000 by Gennady Feldman <gfeldman@mail.com>
+ * "circular buffer" Copyright (C) 2000 by Gennady Feldman <gfeldman@gena01.com>
  *
- * Maintainer: Gennady Feldman <gena01@cachier.com> as of Mar 12, 2001
+ * Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <unistd.h>
 #include <ctype.h>
 #include <sys/syslog.h>
-
-#if __GNU_LIBRARY__ < 5
-# ifdef __alpha__
-#   define klogctl syslog
-# endif
-#else
-# include <sys/klog.h>
-#endif
+#include <sys/klog.h>
 
 #include "busybox.h"
 
@@ -136,12 +128,12 @@ extern int klogd_main(int argc, char **argv)
                switch (opt) {
                case 'c':
                        if ((optarg == NULL) || (optarg[1] != '\0')) {
-                               show_usage();
+                               bb_show_usage();
                        }
                        /* Valid levels are between 1 and 8 */
                        console_log_level = *optarg - '1';
                        if (console_log_level > 7) {
-                               show_usage();
+                               bb_show_usage();
                        }
                        console_log_level++;
                        
@@ -150,16 +142,15 @@ extern int klogd_main(int argc, char **argv)
                        doFork = FALSE;
                        break;
                default:
-                       show_usage();
+                       bb_show_usage();
                }
        }
 
        if (doFork) {
-#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__)
                if (daemon(0, 1) < 0)
-                       perror_msg_and_die("daemon");
-#else
-               error_msg_and_die("daemon not supported");
+                       bb_perror_msg_and_die("daemon");
+#if defined(__uClinux__)
+               vfork_daemon_rexec(argc, argv, "-n");
 #endif
        }
        doKlogd(console_log_level);