int fd, pri = LOG_USER|LOG_NOTICE;
int fromStdinFlag=FALSE;
int toStdErrFlag=FALSE;
+ int stopLookingAtMeLikeThat=FALSE;
char *message, buf[1024], buf1[1024];
time_t now;
size_t addrLength;
if (*((*argv)+1) == '\0') {
fromStdinFlag=TRUE;
}
- while (*(++(*argv))) {
+ stopLookingAtMeLikeThat=FALSE;
+ while (*(++(*argv)) && stopLookingAtMeLikeThat==FALSE) {
switch (**argv) {
case 's':
toStdErrFlag = TRUE;
usage(logger_usage);
}
pri = pencode(*(++argv));
- if (--argc == 0) {
- usage(logger_usage);
- }
- ++argv;
+ stopLookingAtMeLikeThat=TRUE;
break;
default:
usage(logger_usage);
if (fromStdinFlag==TRUE) {
/* read from stdin */
- int i=0;
- char c;
+ int c, i=0;
while ((c = getc(stdin)) != EOF && i<sizeof(buf1)) {
buf1[i++]=c;
}
if (toStdErrFlag==TRUE)
fprintf(stderr, "%s\n", buf);
- write( fd, buf, sizeof(buf));
+ write( fd, buf, strlen(buf)+1);
close(fd);
exit( TRUE);