tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wsvt25 backspace key should match terminfo definition



At Wed, 24 Nov 2021 22:28:45 -0500 (EST), Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
Subject: Re: wsvt25 backspace key should match terminfo definition
>
> Your description below includes a number of unmarked assumptions, which
> may or may not be true.

Going into most of those unlit depths is what I think causes the
uninitiated even more unnecessary confusion.

For example have you ever seen any modern or semi-modern (or any at all)
Unix or Unix-like system where "stty eof" was not '^D' (that you didn't
mess with yourself)?  Nope, didn't think so!  Nobody ever bothers to
change the eof character because they don't type it very often, if ever
at all, and they almost certainly don't have any key on their keyboard
labeled "EOF".  The only settings that really matter to get people off
to a good start are the erase and interrupt characters (and maybe the
kill character, but again unless you're harping back to the V7 or early
SysV days you don't ever bother changing the kill character).  So far as
I can find not even any "stty dec" implementation has been so bold as to
set the eof char to ^Z.  Maybe if there was a "stty msdos".  :-)  [*]

The problem with diving in any deeper than the bare minimum is that it
just confuses the heck out of anyone who doesn't already understand all
the interconnections.  I've seen this over and over and over again for
decades now.

I suppose I should have said it explicitly, but I targeted what I wrote
explicitly to be applicable to those NetBSD users who would need this
kind of help.  Of course I _should_ be preaching to the experts, this
being tech-kern and all, but maybe someone can use what I wrote as the
basis for an even better edited down minimal first-timer introduction.
(or maybe we just implement FreeBSD's VERASE2 and forget about it)

> > Today in NetBSD we can also easily modify what the pressed key sends.
> > (E.g. with wsconsctl(8) or with xmodmap(1), depending on one's
> > environ)
>
> Assumption: the "terminal" in use consists of a keyboard and video
> display directly attached to the computer (as opposed to, say, a real
> serial terminal on a real serial port).

... or it's a virtual machine...

But, yes, of course that's an assumption -- but for today's average
NetBSD user, and in particular one needing this level of help, it's one
that's almost certainly true, even if there is a serial port involved
(because even then there's a 99.999% chance the terminal is actually
another emulator program running on another general purpose computer
with a directly attached keyboard).

> Depending on the shell, and sometimes the shell's settings, ^ may be a
> shell metacharacter, leading to this not working.

Not likely on any modern or semi-modern system.  I last saw one of those
in the late 1980s, and it wasn't even in really Unix-like system.  I do
actually still often quote the '^' character myself, but that's because
I started out on systems where that actually mattered and old habits....

> >     Put a copy of this line in your ~/.profile followed by "tset -r"
>
> Assumption: the user is using a Bourne-derived shell (ie, one that
> reads .profile, as opposed to, say, .cshrc).

Well ~/.login if you're stuck on csh, but default shells in NetBSD are
now very much more POSIX-compatible, and so I'm game to assume that
anyone out on the csh limb is capable of doing their own terminal setup
and certainly won't try to follow anything I wrote.

> (And why would you assume
> the user wants tset -r output blabbed as login noise?)

The tset output is a reminder -- and if anyone needs this level of help
then they probably need a reminder of how things are set up as well and
it certainly won't hurt them.

> >     (You may, or may not, also want to change your interrupt key to
> >     DEL with a command like "stty intr ^?".)
>
> More shell metacharacter assumptions, only even more likely to fail,
> because ? is much more commonly a metacharacter than ^.  Some shells
> will still generate "^?" in the arglist, but some won't.  In some cases
> it will depend on what files are present in some relevant directory.

Well anyone with a file (e.g. in their home directory) starting with '^'
either likely needs more help than my little tutorial was intended to
give, or they're not going to need to read my tutorial in the first
place.

> > The Unix (or "UNIX") tradition is for "stty kill" to be 'DEL' (and
> > erase to be either 'BS' or '#', depending on how far back you go).
>
> If you go back far enough for (what I'm now, loosely, calling) VERASE
> to be #, then I think the corresponding VKILL character is @, is it
> not?  (And, for that setting suite, I think DEL would be VINTR.)

In 7th Edition Unix it was the .sg_erase field in a "struct sgttyb" (for
TIOCGETP and TIOCSETP ioctl commands) but from the command line was
still set with "stty erase" (and "stty kill"), but of course you
couldn't change the interrupt character with the stock stty(1) command
-- but I think you could find and change the interrupt character with
custom code using the TIOCGETC and TIOCSETC ioctls, and a "struct
tchars".

Early UNIX System V added termio(4) with VERASE et al.  (and did not
provide emulation for TIOCGETC and TIOCSETC, but did provide
backward-compatible TIOCGETP and TIOCSETP).  More recent UNIX System V
provided termios(4), still using VERASE et al, and of course NetBSD's
own termios continues to do the same.

Indeed "stty kill" was traditionally '@', and the interrupt character is
and was (and now always will be) ASCII DEL in any Bell Labs Research
Unix as well as in all the AT&T Unix releases.

[*] Speaking of actually changing EOF to ^Z, well it could come in
useful to do so if someone were stuck using the tty line discipline to
translate files imported via a tty device (e.g. even a real serial
port).  That's not been uncommon in days gone by -- I've helped set up
serial ports so that data can be "printed" from some ancient
minicomputer to a serial printer and imported onto something more modern
-- e.g. where printing is the only way to export data from such a system.

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpKFi1PNEa4J.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index