Operating System - HP-UX
1833589 Members
4161 Online
110061 Solutions
New Discussion

cde,reflection,dtterm,stty erase

 
SOLVED
Go to solution
Tore_1
Regular Advisor

cde,reflection,dtterm,stty erase

Hi - logging in via refx,with user who has
sh - shell as default. When I start a dtterm
from the taskbar my backspace doesnt work as erase character. How can I fix this? (please, no guessing)
Thanks for helping.
12 REPLIES 12
Michael Tully
Honored Contributor

Re: cde,reflection,dtterm,stty erase

# stty erase (and press the backspace key)
usually this will give you a ?

This usually will occur when an incorrect terminal type is being used. Check your .dtprofile/.profile or any other environment setting file.

Anyone for a Mutiny ?
T G Manikandan
Honored Contributor

Re: cde,reflection,dtterm,stty erase

#stty erase ^H

for ^H you have to press the backspace key or cntl-v and cntl-h keys
Steve Steel
Honored Contributor

Re: cde,reflection,dtterm,stty erase

Hi


Maybe user does not source his .profile


See .dtprofile or make .Xdefaults in users homedir as read for all and containing the line


*loginShell: true


Then every screen opened works as a login shell and reads all profiles


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Tore_1
Regular Advisor

Re: cde,reflection,dtterm,stty erase

where to put it to make changes permanent?
.profile, .dtprofile, .dtprofile : SOURCEPROFILE=TRUE,.login
doesnt work. These files are not read when I start dtterm from taskbar.
Armin Feller
Honored Contributor

Re: cde,reflection,dtterm,stty erase

The behavior of the backspace key is defined by the value of the erase control character. If you do a stty -a after you're logged in, erase is usually set to ^H.

During login, erase has it's default value as #. This is a standard and described in the termio man page (man 7 termio). Since 10.X, it is possible for the superuser to work around that default value and change those settings by using the /dev/ttyconf device file.

This option is documented towards the end of the stty man page (control char default assignment).

To solve the problem, as the user root execute the following command:

stty erase '^H' < /dev/ttyconf

Try to login again.

Note: The system console is the only device that requires a reboot before this change takes effect.
Jose Mosquera
Honored Contributor

Re: cde,reflection,dtterm,stty erase

Hi,

I'm agree wih Michael, also pls check in Reflection client the "Terminal Keys" configuration inside the "Terminal Setup", the option "VT Backspace Sends" must be "Backspace".

Rgds.
Alex Glennie
Honored Contributor

Re: cde,reflection,dtterm,stty erase

/usr/bin/X11/xmodmap -pke | grep -i backspace

This command should return the following output:

keycode 21 = BackSpace Delete

Run: $ /usr/bin/stty -a

This command should contain the following setting in the output:

erase = ^H

Run: $/usr/bin/X11/xmodmap -e "keycode 111 = BackSpace

This command sets the keysyms (in this case 'BackSpace') to the indicated keycode (in this case 111).

Also note RX has a setting to allow you to remap keys : it needs to be enabled.

Also fyi : dtterms will not execute the contents of your .profile unless you create a $HOME/.Xdefaults file containing :

Dtterm*loginShell:true I'd also advise adding :
*ttyModes: erase ^H intr ^C kill ^U start ^Q stop ^S swtch ^@ susp ^Z

save the file, quit CDE and then try again, if that all checks out/fails : please post contents of your .profile please and/or similar files.

Leif Halvarsson_2
Honored Contributor
Solution

Re: cde,reflection,dtterm,stty erase

Hi,

uncomment this line in your .dtprofile

DTSOURCEPROFILE=true

add the following line to your .profile

ENV=$HOME/.shrc ; export ENV


create a file called .shrc in your home directory with the following line in.

stty erase ^?

Steve Post
Trusted Contributor

Re: cde,reflection,dtterm,stty erase

If I use different ways to log in I might get your backspace problem.
So I type "stty erase ", then hit the backspace key, then hit return. But I'm lazy. That's too much to type. So I shove this into my .profile.

echo "hit the backspace then hit return."
read BACKSPACE
stty erase $BACKSPACE
support_5
Super Advisor

Re: cde,reflection,dtterm,stty erase

speaking of lazy...isn't having to press the backspace key and then enter EVERY time you log in too much work too?

Surely there is a better way to do backspace key mappings. surely this is basic?

I've noticed that a lot depends on which shell you are running. For example, the root user runs the posix shell, but ordinary users use the korn shell. it seems the posix shell handles backspaces better than the korn shell does. Why is this? Is there a way to fix the korn shell so that it maps the backspace key properly (so I don't have to change the default shell for all our users to posix shell)?

for example, if I use the korn shell and telnet from windows, the backspace key doesn't work. But if I change the shell to posix, then the backspace key works.

If I use putty for ssh, then the backspace key works with either shell though?

What's going on here?

Ta

- Andy
Bill Hassell
Honored Contributor

Re: cde,reflection,dtterm,stty erase

The backspace key is defined first by the terminal and then stty defines it's effect. Why is the terminal important? Because there are HUNDREDS of terminals, each one with potentially difference behavior. To see how many terminals are defined in HP/UX, try this:

ls /usr/lib/terminfo/*

It is quite common for some emulators to default to sending the DEL character when you press the backspace key. Putty, like Hypertermianl, Reflection for HP, QCterm and dozens of termnnal emulators, define what to do with special keys. While you might assume that the backspace key on your terminal or your PC will send the ASCII code 0x08, many emulators default to the Tru64/DEC standard of DEL which is code 0x7f and will sometimes be displayed as ^? via the shell.

While many Unix users assume that all terminals are VT100, this is far from the case and a PC is not a terminal!! A PC can be used as a terminal by running a special program which may or may not be a true vt100 emulation. To understand what a 'real' vt100 looks like, visit: http://vt100.net/

But to answer the question about Reflection/X, WRQ's designers have gone back and forth on the best default for the backspace key for both their Reflection for Unix (was known as Reflection/2) and Reflection/X which has a Reflection/2 emulator built-in. The consensus for the last several years has been to set:

backspace sends DEL

(which makes DEC/Tru64 users very happy). So the issue is not the shell (the shell just follows the current stty definitions), nor is it stty (since some emulators don't even send the backspace character when you press backspace). This is why CTRL-H works but backspace doesn't. Your emulator has remapped the backspace key.

So start by standardizing your emulators to backspace=backspace (sorry if you have DEC/Tru64 users...), then realize that ssh, telnet and Xwindows do not always run the same profile at login. Make sure that you setup your .Xdefaults file to handle Xwindows and sshd config will do the same. Note also that POSIX shells (HP's sh, ksh, bash, etc) all start with /etc/profile but csh, tcsh and other non-POSIX shells have their own profiles (a good reason to limit shell choices for users).

Note also that /etc/profile is run when a normal login takes and includes su - user_name. The problem is that many batch or cron jobs will use something like su - oracle or similar to start with a normal environment. In this case, stty should never be executed or you'll get the cryptic error message "Not a typewriter". So in your /etc/profile, you need to protect all commands that require a tty device. These include:

tset ttytype tput stty tabs

And while you're at it, protect parts of the script that are really only for a normal login, things like /etc/motd and /etc/copyright, traps, mail, news and backup notes. To protect them, use something like this:

if tty -s
then
eval $(ttytype -s)
stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
cat /etc/motd
cat /etc/copyright
...more interactive items...
fi


Bill Hassell, sysadmin
support_5
Super Advisor

Re: cde,reflection,dtterm,stty erase

Hi,

So why is it that when I use the same terminal program on the PC, to the same user account on the HP-UX server, but using different shells, than my backspace key works with posix shell but not with korn shell? Everything else is the same, including the stty erase setting, Except for the shell, and so that appears to be making the difference.

I really am struggling to fully understand this... :-(

Thanks though.

- Andy