Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!cca!mirror!ima!haddock!karl From: karl@haddock.UUCP (Karl Heuer) Newsgroups: comp.bugs.4bsd Subject: read() from tty has fencepost error Message-ID: <648@haddock.UUCP> Date: Mon, 29-Jun-87 15:12:56 EDT Article-I.D.: haddock.648 Posted: Mon Jun 29 15:12:56 1987 Date-Received: Wed, 1-Jul-87 00:39:56 EDT Reply-To: karl@haddock.isc.com (Karl Heuer) Distribution: world Organization: Interactive Systems, Boston Lines: 9 main() { char buf[5]; for (;;) printf("%d\n", read(0, buf, 5)); } If you type *exactly* 5 characters and terminate the read with EOT (which is not an EOF in this context, in the middle of a line), the first read returns 5 (as it should) and the second returns 0 (instead of waiting for more input). Tested on 4.3ansan