Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!hao!husc6!bloom-beacon!bu-cs!m2c!ulowell!page From: page@ulowell.cs.ulowell.edu (Bob Page) Newsgroups: comp.bugs.4bsd Subject: msgs(1) doesn't filter garbage characters + FIX Message-ID: <1503@ulowell.cs.ulowell.edu> Date: Fri, 10-Jul-87 16:36:06 EDT Article-I.D.: ulowell.1503 Posted: Fri Jul 10 16:36:06 1987 Date-Received: Sun, 12-Jul-87 12:15:25 EDT Reply-To: page@ulowell.cs.ulowell.edu (Bob Page) Distribution: world Organization: University of Lowell, Computer Science Dept. Lines: 80 Subject: msgs(1) doesn't filter garbage characters + FIX Index: /usr/src/ucb/msgs/msgs.c 4.3BSD Description: Mail to msgs may contain non-printable characters which are not filtered upon delivery. When reading the message, the non-printable characters are delivered to the output device. Repeat-By: % echo ^V^G | mail -s "beep" msgs % msgs Sure, you might like control G and all the CSI stuff for blink and bold, but your system tyrants will love control S. Fix: Apply this patch, which will filter the non-printable characters upon reading. This isn't the best solution, but it's the one finger(1) uses, so I duplicated it. *** msgs.c.orig Thu Apr 10 12:20:43 1986 --- msgs.c Fri Jul 10 16:10:08 1987 *************** *** 464,470 **** while (nlines < 6 && fgets(inbuf, sizeof inbuf, newmsg) && inbuf[0] != '\n') { ! fputs(inbuf, stdout); nlines++; } } --- 464,481 ---- while (nlines < 6 && fgets(inbuf, sizeof inbuf, newmsg) && inbuf[0] != '\n') { ! register i = 0; ! for (;;) { ! register char c = inbuf[i++]; ! if (c == '\n') { ! putchar(c); ! break; ! } ! if (isprint(c) || isspace(c)) ! putchar(c); ! else ! putchar(c ^ 100); ! } nlines++; } } *************** *** 590,596 **** putc('\n', outf); while (fgets(inbuf, sizeof inbuf, newmsg)) { ! fputs(inbuf, outf); if (ferror(outf)) { clearerr(outf); break; --- 601,618 ---- putc('\n', outf); while (fgets(inbuf, sizeof inbuf, newmsg)) { ! register i = 0; ! for (;;) { ! register char c = inbuf[i++]; ! if (c == '\n') { ! putc(c, outf); ! break; ! } ! if (isprint(c) || isspace(c)) ! putc(c, outf); ! else ! putc(c ^ 100, outf); ! } if (ferror(outf)) { clearerr(outf); break; -- Bob Page, U of Lowell CS Dept. page@ulowell.{uucp,edu,csnet}