12 char buf[800]; /* syslog truncates long lines (or crashes); GPACIC */
13 int bufpos = 0; /* 0 <= bufpos < sizeof(buf) */
15 int priority; /* defined if flagcont */
16 char stamp[FMT_ULONG + FMT_ULONG + 3]; /* defined if flagcont */
22 gettimeofday(&tv,(struct timezone *) 0);
24 s += fmt_ulong(s,(unsigned long) tv.tv_sec);
26 s += fmt_uint0(s,(unsigned int) tv.tv_usec,6);
35 syslog(priority,"%s+%s",stamp,buf); /* logger folds invisibly; GPACIC */
39 if (str_start(buf,"warning:")) priority = LOG_WARNING;
40 if (str_start(buf,"alert:")) priority = LOG_ALERT;
41 syslog(priority,"%s %s",stamp,buf);
56 unsigned long facility;
57 scan_ulong(argv[2],&facility);
58 openlog(argv[1],0,facility << 3);
61 openlog(argv[1],0,LOG_MAIL);
63 openlog("splogger",0,LOG_MAIL);
66 if (substdio_get(subfdin,&ch,1) < 1) _exit(0);
67 if (ch == '\n') { flush(); flagcont = 0; continue; }
68 if (bufpos == sizeof(buf) - 1) flush();
69 if ((ch < 32) || (ch > 126)) ch = '?'; /* logger truncates at 0; GPACIC */