aboutsummaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
authorGravatar Rob Landley <rob@landley.net>2005-09-14 15:36:52 +0000
committerGravatar Rob Landley <rob@landley.net>2005-09-14 15:36:52 +0000
commit570f655ee4bf56972a91873dee4bb9ef7bc48513 (patch)
tree12bbcc4c2928657dbaea8594f1ff79b2ed1d00bf /sysklogd
parentb7285001c9f21bd2971f9fd511b229e1f0da541c (diff)
downloadbusybox-570f655ee4bf56972a91873dee4bb9ef7bc48513.tar.gz
busybox-570f655ee4bf56972a91873dee4bb9ef7bc48513.tar.bz2
Cleanup patch from tito: migrate option parsing to the bb_ functions and fix
types.
Diffstat (limited to 'sysklogd')
-rw-r--r--sysklogd/klogd.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index c908b593c..e4c8a630e 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -113,37 +113,24 @@ static void doKlogd(const int console_log_level)
}
}
+#define OPT_LEVEL 1
+#define OPT_FOREGROUND 2
+
extern int klogd_main(int argc, char **argv)
{
- /* no options, no getopt */
- int opt;
- int doFork = TRUE;
- unsigned char console_log_level = -1;
+ unsigned long opt;
+ char *c_arg;
+ int console_log_level = -1;
/* do normal option parsing */
- while ((opt = getopt(argc, argv, "c:n")) > 0) {
- switch (opt) {
- case 'c':
- if ((optarg == NULL) || (optarg[1] != '\0')) {
- bb_show_usage();
- }
- /* Valid levels are between 1 and 8 */
- console_log_level = *optarg - '1';
- if (console_log_level > 7) {
- bb_show_usage();
- }
- console_log_level++;
-
- break;
- case 'n':
- doFork = FALSE;
- break;
- default:
- bb_show_usage();
- }
+ opt = bb_getopt_ulflags (argc, argv, "c:n", &c_arg);
+
+ if (opt & OPT_LEVEL) {
+ /* Valid levels are between 1 and 8 */
+ console_log_level = bb_xgetlarg(c_arg, 10, 1, 8);
}
- if (doFork) {
+ if (!(opt & OPT_FOREGROUND)) {
#if defined(__uClinux__)
vfork_daemon_rexec(0, 1, argc, argv, "-n");
#else /* __uClinux__ */