summaryrefslogtreecommitdiff
path: root/sysklogd/logger.c
diff options
context:
space:
mode:
authorEric Andersen2001-07-19 22:28:02 +0000
committerEric Andersen2001-07-19 22:28:02 +0000
commit20aab260e2f7011523402464fb079f48e5899890 (patch)
treef7822e652f54884459d525f57f1ef18c03a126f7 /sysklogd/logger.c
parent0382eb886529fc4dab170e7d66883c20fe0e2883 (diff)
downloadbusybox-20aab260e2f7011523402464fb079f48e5899890.zip
busybox-20aab260e2f7011523402464fb079f48e5899890.tar.gz
Some adjustments, mostly from David McCullough <davidm@lineo.com> to
make busybox be more uClinux friendly. I also adjusted Config.h for uClinux so it will automagically disable apps the arn't going to work without fork() and such. -Erik
Diffstat (limited to 'sysklogd/logger.c')
-rw-r--r--sysklogd/logger.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index b8aae3d..623a4f9 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -127,14 +127,20 @@ extern int logger_main(int argc, char **argv)
}
}
+ openlog(name, option, (pri | LOG_FACMASK));
if (optind == argc) {
- /* read from stdin */
- i = 0;
- while ((c = getc(stdin)) != EOF && i < sizeof(buf)) {
- buf[i++] = c;
- }
- buf[i++] = '\0';
- message = buf;
+ do {
+ /* read from stdin */
+ i = 0;
+ while ((c = getc(stdin)) != EOF && c != '\n' &&
+ i < (sizeof(buf)-1)) {
+ buf[i++] = c;
+ }
+ if (i > 0) {
+ buf[i++] = '\0';
+ syslog(pri, "%s", buf);
+ }
+ } while (c != EOF);
} else {
len = 1; /* for the '\0' */
message=xcalloc(1, 1);
@@ -146,12 +152,10 @@ extern int logger_main(int argc, char **argv)
strcat(message, " ");
}
message[strlen(message)-1] = '\0';
+ syslog(pri, "%s", message);
}
- /*openlog(name, option, (pri | LOG_FACMASK));
- syslog(pri, "%s", message);
- closelog();*/
- syslog_msg_with_name(name,(pri | LOG_FACMASK),pri,message);
+ closelog();
return EXIT_SUCCESS;
}