Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ames!pacbell!hoptoad!gnu
From: gnu@hoptoad.uucp (John Gilmore)
Newsgroups: comp.unix.wizards
Subject: Specifying tty delimiter characters
Message-ID: <4528@hoptoad.uucp>
Date: 11 May 88 03:55:04 GMT
References: <8776@sol.ARPA> <4493@hoptoad.uucp> <98@skep2.ATT.COM>
Organization: Grasshopper Group in San Francisco
Lines: 24

wcs@skep2.ATT.COM (Bill.Stewart.) wrote:
> One feature I've wished was available in a TTY driver is the ability to
> specify a bunch of characters (e.g. control characters), and tell it
> to "read until N input characters or a special character".

The Data General AOS system implemented this uniformly across the file
system.  If you did "data sensitive" reads, it would read up to a delimiter
and just return you that much.  This was true of files as well as devices.
You could default the delimiter table (to CR, NL, FF, NUL, etc) or specify
it, as a 256-bit table.  The data-sensitive mode could be specified at
open time, or on individual reads.

On a Unix system, I suspect that the right place to make this pervasive
is in standard I/O.  On disk files, it would itself scan for the
delimiters; on ttys on old Unix systems, it would do raw mode reads; on
ttys on enhanced Unix systems, it could pass the delimiter table to the
kernel and let it terminate a longer, less resource-ful read.  You'd
need to define and implement a couple of new stdio functions for "read
up to delimiter", "set delimiter table", and "write up to delimiter".
Then wait til enough people use them so that the kernels can be
improved to deal.
-- 
John Gilmore  {sun,pacbell,uunet,pyramid,ihnp4}!hoptoad!gnu        gnu@toad.com
"Use the Source, Luke...."