Subject: Re: ^W killed my line
To: None <current-users@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: current-users
Date: 03/10/2000 00:45:48
[ On Thursday, March 2, 2000 at 02:33:17 (-0500), der Mouse wrote: ]
> Subject: Re: ^W killed my line
>
> > That's nice in theory, but this is Unix, not AmigaOS, and the tty
> > driver's real job is to do the I/O, not to do input editing.  In Unix
> > the application does the editing and the commonality and consistency
> > is achieved by using the same code in every application (eg. in this
> > case linking against libedit).
> 
> It's hard to believe you're sitting there with a straight face and
> recommending code duplication in *every application* instead of putting
> the code in *one* place.  (Well, okay, only those that take
> line-oriented input; that's most of the programs that read from stdin
> at all, based on a quick look at /bin and /usr/bin.)

Using a library such as libedit counts as code reuse in my books....

BTW, I'd only count interactive programs as ones needing line editing.

Sure if you had libedit in your tty line discipline you do away with
using an editor to create most small files and certainly most quick
e-mails, etc.

However when you get down to the nitty gritty details you often find
that the application wants/needs some hooks into the editing functions
(customised word completion, etc.) and before you know it you end up
with a kernel API as big as MS-Windows!  (OK, maybe not that big, but
big enough.)

I'd rather keep the tty line discipline as simple as possible thanks.
Termios(4) is already complex enough an API, though of course some
aspects of its design beats the pants off stty()/gtty().

> But quite aside from that...this simply is false to historical fact, at
> least in the last what, ten, fifteen years - however long I've been at
> this stuff.  Everything since 4.1c, the first UNIX variant I used, has
> done it as described, using the tty driver as *the* means of line
> editing for line-oriented input.  A very few programs, most notably
> shells, have had more sophisticated input line editors added to them,
> but only recently (the last year or two) have I noticed it creeping
> into other programs.

Korn added full line editing to ksh sometime before 1985 and I've been
using it since about then.  I remember several competing "wrapper"
libraries that provided line editing being posted to either net.sources
or mod.sources too....  I don't know that anyone seriously added a
libedit equivalent to something as basic as "cat" though....  :-)

> Before that...yes, the line editing provided by the tty driver was even
> more rudimentary (typically just erase and kill).  So was everything
> else; certainly in those days there was no libedit, readline, or
> whatever you call it, infecting programs that did line-based input.

Since I had the benefit of using a full-screen editor on V7 long before
'vi' was available on the machines I was using I had the advantage of
the convenience of those features that I'd grown to like on personal
computers (S-100 machines of the day :-).  I was an early adopter of
using the "newcrt" mode when it came along (we had to put "stty newcrt"
in our .profile if we wanted such features), but I never really had any
expectations that it should grow to have full editing features.

> > I'd recommend that anyone interested in this heritage of Unix look
> > not only at some of the older papers on the subject, but also look at
> > the way Plan 9 approached this stuff too.
> 
> Weren't you the one who just recently was saying that Plan 9 was
> definitely *not* UNIX?  It's an interesting alternative approach, but I
> can't see much point in recommending it to someone interested "this
> heritage of Unix", except perhaps for contrast - and then I'd
> definitely point at a few others as well, like (say) VMS.

Ah, yes of course.  My point is indeed to use it not only as a contrast
to the way "commercial" unix (under the influence of academics from
California) has gone in this respect, but also as a demonstration of the
direction the creators of unix took.  Of course much of what's in Plan 9
is no doubt influenced by their experience with the jerq and blit and
their experiments with moving almost all of the interactivity directly
to the terminal.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>