Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site allegra.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!jpl From: jpl@allegra.UUCP (John P. Linderman) Newsgroups: net.bugs.4bsd,net.unix-wizards Subject: msgs can truncate all messages once interrupted Message-ID: <3158@allegra.UUCP> Date: Tue, 12-Mar-85 12:29:56 EST Article-I.D.: allegra.3158 Posted: Tue Mar 12 12:29:56 1985 Date-Received: Wed, 13-Mar-85 01:14:51 EST Distribution: net.bugs.4bsd,net.unix-wizards Organization: AT&T Bell Laboratories, Murray Hill Lines: 43 Xref: watmath net.bugs.4bsd:1422 net.unix-wizards:12411 Index: ucb/msgs/msgs.c 4.2BSD Description: If one runs msgs and interrupts it during a long printout, only a single line of all subsequent messages may be displayed. Repeat-By: Run msgs -50 to get the last 50 messages. Don't use the -p option. Hit interrupt while it is printing a long message. If you do this often enough, only the first line of each message will be displayed for all subsequent messages. Fix: The problem is that interrupting the printout can cause a write error on stdout. (This won't always happen, which is why you must bash on interrupt for several messages before it may appear.) If and when the error occurs, ferror(stdout) will remain true, and the loop that prints the messages will be exited after printing a single line. An easy fix is to clear any existing error before attempting to print each message in prmesg(). A context diff of msgs.c follows. --- msgs.c Tue Mar 12 12:06:15 1985 *************** *** 558,563 } else outf = stdout; if (seensubj) putc('\n', outf); --- 558,564 ----- } else outf = stdout; + clearerr(outf); if (seensubj) putc('\n', outf);