diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-07-19 22:28:02 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-07-19 22:28:02 +0000 |
commit | 20aab260e2f7011523402464fb079f48e5899890 (patch) | |
tree | f7822e652f54884459d525f57f1ef18c03a126f7 /sysklogd/logger.c | |
parent | 0382eb886529fc4dab170e7d66883c20fe0e2883 (diff) | |
download | busybox-w32-20aab260e2f7011523402464fb079f48e5899890.tar.gz busybox-w32-20aab260e2f7011523402464fb079f48e5899890.tar.bz2 busybox-w32-20aab260e2f7011523402464fb079f48e5899890.zip |
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.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sysklogd/logger.c b/sysklogd/logger.c index b8aae3d28..623a4f9e5 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c | |||
@@ -127,14 +127,20 @@ extern int logger_main(int argc, char **argv) | |||
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | openlog(name, option, (pri | LOG_FACMASK)); | ||
130 | if (optind == argc) { | 131 | if (optind == argc) { |
131 | /* read from stdin */ | 132 | do { |
132 | i = 0; | 133 | /* read from stdin */ |
133 | while ((c = getc(stdin)) != EOF && i < sizeof(buf)) { | 134 | i = 0; |
134 | buf[i++] = c; | 135 | while ((c = getc(stdin)) != EOF && c != '\n' && |
135 | } | 136 | i < (sizeof(buf)-1)) { |
136 | buf[i++] = '\0'; | 137 | buf[i++] = c; |
137 | message = buf; | 138 | } |
139 | if (i > 0) { | ||
140 | buf[i++] = '\0'; | ||
141 | syslog(pri, "%s", buf); | ||
142 | } | ||
143 | } while (c != EOF); | ||
138 | } else { | 144 | } else { |
139 | len = 1; /* for the '\0' */ | 145 | len = 1; /* for the '\0' */ |
140 | message=xcalloc(1, 1); | 146 | message=xcalloc(1, 1); |
@@ -146,12 +152,10 @@ extern int logger_main(int argc, char **argv) | |||
146 | strcat(message, " "); | 152 | strcat(message, " "); |
147 | } | 153 | } |
148 | message[strlen(message)-1] = '\0'; | 154 | message[strlen(message)-1] = '\0'; |
155 | syslog(pri, "%s", message); | ||
149 | } | 156 | } |
150 | 157 | ||
151 | /*openlog(name, option, (pri | LOG_FACMASK)); | 158 | closelog(); |
152 | syslog(pri, "%s", message); | ||
153 | closelog();*/ | ||
154 | syslog_msg_with_name(name,(pri | LOG_FACMASK),pri,message); | ||
155 | return EXIT_SUCCESS; | 159 | return EXIT_SUCCESS; |
156 | } | 160 | } |
157 | 161 | ||