From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!freenix!deine.net!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail From: Erik Naggum Newsgroups: comp.lang.lisp Subject: Re: Checking for EOF Date: 11 Nov 2002 22:29:28 +0000 Organization: Naggum Software, Oslo, Norway Lines: 33 Message-ID: <3246042568510031@naggum.no> References: <4lm4057dr.fsf@beta.franz.com> <47kfj6be0.fsf@beta.franz.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: maud.ifi.uio.no 1037053769 7511 129.240.65.211 (11 Nov 2002 22:29:29 GMT) X-Complaints-To: abuse@ifi.uio.no NNTP-Posting-Date: 11 Nov 2002 22:29:29 GMT Mail-Copies-To: never User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.lisp:46324 * Duane Rettig | On the other hand, if you try typing into a terminal that is so | connected, you would not be able to process data after the Ctrl-D, which | is a normal action for a terminal. Not so. When the C-d is not at the start of the input, it only forces the terminal handler to send the data collected so far to the caller. If you monitor a program that calls the `read´ system call until it returns 0 and look at what it actually does with a system-call tracer, you will see that you can indeed continue to type after a C-d that does not follow another C-d or C-j that pushed the line with the newline to the caller, and if the caller waits for a newline before it terminates its loop of `read´ calls, you should see two major effects for which this is expressly employed: You can write longer lines than the hard line buffer limit that is often only 256 characters, and you cannot edit the input line past the C-d. Under any Linux system, the command `strace cat´ will do just fine. | In other words, on a terminal, an eof is just like another character, and | should be processed as if it were a character, including its un-read | characteristics. Not in line mode. You never see the C-d in cooked mode any more than you see C-r or any of the other line-editing characters. If you set a terminal line to raw mode so that you do see C-d and the like, there /is/ no out-of-band end-of-file signal, and you have to settle for an in-band signal, instead. -- Erik Naggum, Oslo, Norway Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.