aboutsummaryrefslogtreecommitdiff
path: root/sysklogd/logger.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-25 08:06:22 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-25 08:06:22 +0000
commitbefda6e4ed06697f20fc114718ef0c92c5c6e56a (patch)
tree655d3ba8ac9b35679a23fccf019490e5462d192a /sysklogd/logger.c
parent3843e96252a823b4fdfc89c61d00342bf011ad88 (diff)
downloadbusybox-befda6e4ed06697f20fc114718ef0c92c5c6e56a.tar.gz
Stuf
Diffstat (limited to 'sysklogd/logger.c')
-rw-r--r--sysklogd/logger.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index 0683838cc..dfbc557ec 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -118,13 +118,17 @@ extern int logger_main(int argc, char **argv)
{
struct sockaddr_un sunx;
int fd, pri = LOG_USER|LOG_NOTICE;
+ int fromStdinFlag=FALSE;
int toStdErrFlag=FALSE;
- char *message, buf[1024];
+ char *message, buf[1024], buf1[1024];
time_t now;
size_t addrLength;
/* Parse any options */
while (--argc > 0 && **(++argv) == '-') {
+ if (*((*argv)+1) == '\0') {
+ fromStdinFlag=TRUE;
+ }
while (*(++(*argv))) {
switch (**argv) {
case 's':
@@ -146,15 +150,21 @@ extern int logger_main(int argc, char **argv)
}
}
- if (argc>=1)
- if (**argv=='-') {
- /* read from stdin */
+ if (fromStdinFlag==TRUE) {
+ /* read from stdin */
+ int i=0;
+ char c;
+ while ((c = getc(stdin)) != EOF && i<sizeof(buf1)) {
+ buf1[i++]=c;
+ }
+ message=buf1;
+ } else {
+ if (argc>=1) {
+ message=*argv;
} else {
- message=*argv;
+ fprintf(stderr, "No message\n");
+ exit( FALSE);
}
- else {
- fprintf(stderr, "No message\n");
- exit( FALSE);
}
memset(&sunx, 0, sizeof(sunx));