[comp.unix.questions] DELETE/BACKSPACE key paradox on RS/6000

jxt@cpdws1.ctd.ornl.gov (Tolliver J S) (03/15/91)

Hi!
This is being cross-posted to comp.unix.questions. First a small introduction.

A few weeks ago, I started a flurry of comments about the
delete/backspace keys and
an RS/6000. The problem was that I claimed that the delete key on my
VT100
teminal emulator wasn't being interpreted "correctly" by AIX and I
wanted to
change it, preferably with the vt100 terminfo entry instead of stty.

It seems that the concensus opinion is that AIX is right and I am
wrong, that real VT100's have both backspace and delete keys, that I should
be using the correct key for the purpose intended, and that my terminal
emulator should either include both keys or allow the delete key to be
remapped to a backspace. Furthermore, if my terminal emulator does not have
both keys and/or allow remapping, then it is brain-dead. And perhaps I, too,
am brain-dead for using such a terminal emulator.

Now for some explanations. It is true that VT100's have both keys. My terminal
emulator also supports both. It also supports remapping of the delete key to
be DELETE or BACKSPACE or anything else I want it to be. So maybe it's only
me that is brain-dead :-)

The problem is that the key marked delete on my keyboard is in the convenient
location for (all-to-frequent) use and that getting to the backspace key is
cumbersome. So why not just remap the delete key to send BACKSPACE? Well, I
use the same keyboard and terminal emulator to connect to a variety of
machines, most of which use DELETE for the erase function. Here's a list:

erase is DELETE		erase is BACKSPACE
---------------		------------------
Dec Ultrix		IBM AIX 3.1
SUN			Silicon Graphics IRIS
Intel Hypercube
Apple AU/X
NeXT
Cray UNICOS
Cray CTSS
VAX/VMS
DEC TOPS-10

I don't claim that this list is exhaustive, just the systems I regularly use
and/or have access to and have tried. I'm sure many of the readers of this
newsgroup could add to either list.

In any case, I don't want to remap my delete key between each rlogin, etc. So
I want to leave the delete key as DELETE and tell AIX to use DELETE as erase.
And that is easy to do with stty in my .profile, along with appropriate logic
to decide if I am at the console or at a remote VT100 or emulator.

However, as a fledgling system administrator, I receive all the complaints from
neophyte unix users who can't understand why delete doesn't delete. You see,
almost every other system in use at this site uses delete to delete (er,
excuse me, erase) and that is what people expect. To solve this dilema, I COULD
tell everyone to put something like [ $TERM = vt100 ] && stty erase ^? in their
.profile or .login file, but I would prefer a system-wide way of handling it
instead of each user doing it on an individual basis. Of course, at the console
keyboard, I need erase to be BACKSPACE so I can't really do it system-wide
(even if that would be possible). That is why I hit upon the apparently
bad idea of mucking with the vt100 terminfo database to change the behavior
of the delete key.

So now my question is this:
Is the best way of handling this DELETE/BACKSPACE identity crisis with a
stty in everyone's .profile or .login?
Or is there some system-wide method, possibly using terminfo, that would work
and apply to everyone except console logins?

Please note, the problem sometimes seems to get much worse. For example,
logged into a SUN, delete works normally (i.e., it erases), then rlogin to
the RS/6000 passes through .login, which does stty erase ^?, and delete
still works "normally". But then doing an xterm or aixterm grandly messes
up the delete key. It now echoes multiple characters--escape-something-or-
other. Furthermore stty erase <del>, where <del> is the delete key doesn't
help since stty erase is looking for a single character. In fact, I think
this will set the erase character to be escape, but certainly not the delete
key. Go back to the SUN and do an rsh to the RS/6000 and start xterm or
aixterm. The rsh doesn't go through .login; delete still echoes multiple
characters and stty erase doesn't work. Or, from a Macintosh running MacX,
connect to the RS/6000 (which MacX does via rsh), and delete still echoes
multiple characters.

Second question: Is there anyway to fix THAT? Is this an aixterm problem? It
seems that the key-mapping gets done at some lower level even before .login
and grandly messes up the delete key. Note that MacX to a SUN, Ultrix, etc.
works just fine.
--
Many thanks,
Johnny Tolliver (jxt@ornl.gov)

gwyn@smoke.brl.mil (Doug Gwyn) (03/15/91)

In article <1991Mar14.173058.16978@cs.utk.edu> jxt@cpdws1.ctd.ornl.gov (Tolliver J S) writes:
>machines, most of which use DELETE for the erase function. Here's a list:

I rather doubt that any of the UNIX variants you listed really would
default to use of ASCII DEL for the "erase" character, as long-standing
UNIX convention is to use DEL as the interrupt key.  Normal UNIX systems
have some initial terminal characteristics file that can be configured
to determine what the terminal handler is set to when a login occurs.
Check your System Administrator documentation to find out how to use this.

johnbob@there.austin.ibm.com (03/16/91)

This is the best description of the problem that I have seen:

In article <1991Mar14.173058.16978@cs.utk.edu> jxt@cpdws1.ctd.ornl.gov (Tolliver J S) writes:
>Hi!
>This is being cross-posted to comp.unix.questions. First a small introduction.
>
>A few weeks ago, I started a flurry of comments about the
>delete/backspace keys and
...
>The problem is that the key marked delete on my keyboard is in the convenient
>location for (all-to-frequent) use and that getting to the backspace key is
>cumbersome. So why not just remap the delete key to send BACKSPACE? Well, I
On my keyboard it is the other way around.   The backspace key is easy to
get to and the delete key is inconvenient.

>cumbersome. So why not just remap the delete key to send BACKSPACE? Well, I
>use the same keyboard and terminal emulator to connect to a variety of
>machines, most of which use DELETE for the erase function. Here's a list:
>
>erase is DELETE		erase is BACKSPACE
>---------------		------------------
>Dec Ultrix		IBM AIX 3.1
>SUN			Silicon Graphics IRIS
>Intel Hypercube
>Apple AU/X
>NeXT
>Cray UNICOS
>Cray CTSS
>VAX/VMS
>DEC TOPS-10
>
I don't have all these other machines to look at so I'll just give a 
suggestion.  I can't test to see that it will work on all the machines
listed.

>...
>seems that the key-mapping gets done at some lower level even before .login
>...
>--
>Many thanks,
>Johnny Tolliver (jxt@ornl.gov)

In the directory "/usr/lib/nls/im/En_US" you may find a file "imkeymap.us".
(do this as root)
I looked through it and found lines that started with "0xff08" and "0xffff"
(line 266 and line 370).  I replaced the contents of line "0xffff" with the
contents of line "0xff08".  Here is what it looked like:

#0xffff "\033[P"    "\033[P"    "\033[P"	   "\033[P"    "\033[142q" U U U "\033[M"    U U U U U U U U
0xffff "\10" "\10"    "\10"    "\10" "\177"	 U U U "\033[071q" U U U U U U U U

I saved the file and ran these commands (as root):

 mv imkeymap imkeymap.orig
 keycomp < imkeymap.us > imkeymap

I started up an aixterm and both backspace and delete would delete characters.
You may also have to do the same thing for the keymap file "imkeymap.vt" in
directory "/usr/lib/nls/im/En_US.ascii".

As I said before, I have no way to test it.
Disclaimers apply.

Have a day.

-john harvey

john harvey
@cs.utexas.edu:ibmchs!there.austin.ibm.com!johnbob
uunet!cs.utexas.edu!ibmaus!auschs!there.austin.ibm.com!johnbob
I don't represent anyone.  I don't speak for anyone.  This message has not
been approved by U.S., Israeli, or Iraqi censors.
-- 
john harvey
@cs.utexas.edu:ibmchs!there.austin.ibm.com!johnbob
uunet!cs.utexas.edu!ibmaus!auschs!there.austin.ibm.com!johnbob
I don't represent anyone.  I don't speak for anyone.  This message has not

guy@auspex.auspex.com (Guy Harris) (03/17/91)

>I rather doubt that any of the UNIX variants you listed really would
>default to use of ASCII DEL for the "erase" character, as long-standing
>UNIX convention is to use DEL as the interrupt key.

I don't doubt it in the least, because I've *used* SunOS, and it *does*
default to DEL.

BSD defaults to DEL, because the conventions *it* uses by default are
those of DEC operating systems (except for the end-of-file character;
DEC OS's tend to use ^Z, as I remember, but BSD uses the UNIX ^D
convention for end-of-file, and uses ^Z for "suspend").  A number of the
OS's the original poster listed as using DEL for the "erase" character
inherited that convention from BSD.