SCCS-vsn: usr.bin/logger/logger.c 6.10
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)logger.c 6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)logger.c 6.10 (Berkeley) %G%";
#endif /* not lint */
#include <stdio.h>
#endif /* not lint */
#include <stdio.h>
extern int optind;
int pri = LOG_NOTICE;
int ch, logflags = 0;
extern int optind;
int pri = LOG_NOTICE;
int ch, logflags = 0;
- char *tag, buf[200], *getlogin();
+ char *tag, buf[1024], *getlogin();
tag = NULL;
while ((ch = getopt(argc, argv, "f:ip:t:")) != EOF)
tag = NULL;
while ((ch = getopt(argc, argv, "f:ip:t:")) != EOF)
register char *p, *endp;
int len;
register char *p, *endp;
int len;
- for (p = buf, endp = buf + sizeof(buf) - 1;;) {
+ for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) {
- if (p + len < endp && p > buf) {
- *--p = '\0';
+ if (p + len > endp && p > buf) {
syslog(pri, "%s", buf);
p = buf;
}
syslog(pri, "%s", buf);
p = buf;
}
- if (len > sizeof(buf) - 1) {
+ if (len > sizeof(buf) - 1)
syslog(pri, "%s", *argv++);
syslog(pri, "%s", *argv++);
- if (!--argc)
- break;
- } else {
+ else {
+ if (p != buf)
+ *p++ = ' ';
- p += len;
- if (!--argc)
- break;
- *p++ = ' ';
- *--p = '\0';
- if (p != buf) {
- *p = '\0';