- strcpy(t, "/dev/");
- strcat(t, tty);
-
- signal(SIGALRM, SIG_DFL); /* blow away if open hangs */
- alarm(10);
-
- if((f = fopen(t, "w")) == NULL) {
- fprintf(stderr,"cannot open %s\n", t);
- exit(1);
- }
- setbuf(f, buf);
- fprintf(f,
- "\n\a\a\aBroadcast Message from %s!%s (%.*s) at %d:%02d ...\r\n\n"
- , hostname
- , who
- , sizeof(utmp[sline].ut_line)
- , utmp[sline].ut_line
- , localclock -> tm_hour
- , localclock -> tm_min
- );
- /* fwrite(mesg, msize, 1, f); */
- for (cp = mesg, c = msize; c-- > 0; cp++) {
- ch = *cp;
- if (ch == '\n')
- putc('\r', f);
- putc(ch, f);