This commit is contained in:
Eric Andersen
1999-11-25 08:06:22 +00:00
parent 3843e96252
commit befda6e4ed
8 changed files with 49 additions and 26 deletions

View File

@@ -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 */
} else {
message=*argv;
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 {
fprintf(stderr, "No message\n");
exit( FALSE);
}
else {
fprintf(stderr, "No message\n");
exit( FALSE);
}
memset(&sunx, 0, sizeof(sunx));