diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-11-25 08:06:22 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-11-25 08:06:22 +0000 |
commit | befda6e4ed06697f20fc114718ef0c92c5c6e56a (patch) | |
tree | 655d3ba8ac9b35679a23fccf019490e5462d192a /sysklogd | |
parent | 3843e96252a823b4fdfc89c61d00342bf011ad88 (diff) | |
download | busybox-w32-befda6e4ed06697f20fc114718ef0c92c5c6e56a.tar.gz busybox-w32-befda6e4ed06697f20fc114718ef0c92c5c6e56a.tar.bz2 busybox-w32-befda6e4ed06697f20fc114718ef0c92c5c6e56a.zip |
Stuf
Diffstat (limited to 'sysklogd')
-rw-r--r-- | sysklogd/logger.c | 26 |
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) | |||
118 | { | 118 | { |
119 | struct sockaddr_un sunx; | 119 | struct sockaddr_un sunx; |
120 | int fd, pri = LOG_USER|LOG_NOTICE; | 120 | int fd, pri = LOG_USER|LOG_NOTICE; |
121 | int fromStdinFlag=FALSE; | ||
121 | int toStdErrFlag=FALSE; | 122 | int toStdErrFlag=FALSE; |
122 | char *message, buf[1024]; | 123 | char *message, buf[1024], buf1[1024]; |
123 | time_t now; | 124 | time_t now; |
124 | size_t addrLength; | 125 | size_t addrLength; |
125 | 126 | ||
126 | /* Parse any options */ | 127 | /* Parse any options */ |
127 | while (--argc > 0 && **(++argv) == '-') { | 128 | while (--argc > 0 && **(++argv) == '-') { |
129 | if (*((*argv)+1) == '\0') { | ||
130 | fromStdinFlag=TRUE; | ||
131 | } | ||
128 | while (*(++(*argv))) { | 132 | while (*(++(*argv))) { |
129 | switch (**argv) { | 133 | switch (**argv) { |
130 | case 's': | 134 | case 's': |
@@ -146,15 +150,21 @@ extern int logger_main(int argc, char **argv) | |||
146 | } | 150 | } |
147 | } | 151 | } |
148 | 152 | ||
149 | if (argc>=1) | 153 | if (fromStdinFlag==TRUE) { |
150 | if (**argv=='-') { | 154 | /* read from stdin */ |
151 | /* read from stdin */ | 155 | int i=0; |
156 | char c; | ||
157 | while ((c = getc(stdin)) != EOF && i<sizeof(buf1)) { | ||
158 | buf1[i++]=c; | ||
159 | } | ||
160 | message=buf1; | ||
161 | } else { | ||
162 | if (argc>=1) { | ||
163 | message=*argv; | ||
152 | } else { | 164 | } else { |
153 | message=*argv; | 165 | fprintf(stderr, "No message\n"); |
166 | exit( FALSE); | ||
154 | } | 167 | } |
155 | else { | ||
156 | fprintf(stderr, "No message\n"); | ||
157 | exit( FALSE); | ||
158 | } | 168 | } |
159 | 169 | ||
160 | memset(&sunx, 0, sizeof(sunx)); | 170 | memset(&sunx, 0, sizeof(sunx)); |