Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am in the process of migrating a legacy 4GL application from SCO OpenServer 5.0.7 to CentOS (Red Hat) Linux 5.9.

There are a number of screens that prompt the user to press "DEL to ABORT" but is actually trapping the interrupt signal.

How can I map stty intr to the DEL key for consistency? Is it possible to map interrupt to an ansi sequence?

PuTTY is generating the following control codes for each of these keys:

DEL: ^[[3~

BACKSPACE: ^?

SHIFT BACKSPACE: ^H

I can't find an option within PuTTY to remap the DEL key specifically.

share|improve this question

2 Answers 2

The character it's expecting is ^?, which was a key labeled DEL on their legacy terminals (e.g. VT220).

You can do stty intr ^? before starting the application to make it use this for the interrupt signal, but I don't know if there's a way to configure Putty to send it for DEL. I know some other terminals allow it to be remapped.

You can't just change the message it prints?

You may need a different terminal emulator, or an extra terminal emulation layer similar to screen between your terminal and the application.

EDIT: If you select the "SCO" option under "Function keys and keypad", the DEL key should generate ^?, which you can map to stty intr. You should also set Backspace to Control-H. It's also possible that the application may expect the character sequences the Home, End, etc keys generate in this mode, since you said it was an app designed to run on a SCO operating system.

However, you should consider @StephaneChazelas' answer, since using screen for this would create a more controlled environment (i.e. you wouldn't have to configure putty on everyone's client machine)

share|improve this answer
    
I have temporarily mapped interrupt to ^H but the users insist on keeping the DEL key. –  JamesA Apr 1 '13 at 16:42
    
@JamesA See my edit. –  Random832 Apr 1 '13 at 20:43

The intr character, has to be a character, it can't be a sequence of characters.

As Random832 suggested, using screen is probably your best bet. It would then work from any terminal.

screen emulates a terminal inside another terminal. By default, the terminal it emulates sends ^? on Backspace and ^[[3~ on Delete just like PuTTY, but you can change that.

For instance, if you create a file that contains:

bindkey -k kb stuff "\10"
bindkey -k kD stuff "\177"
termcap * '' 'kD=\177:kb=\10'
screen sh -c 'stty intr "^?" erase "^H"; exec my-legacy-app'

And use it as screen -c /path/to/that-file

It would emulate one where Backspace sends ^H and Delete sends ^?.

The third line is to tell so to applications that use termcap (via the $TERMCAP environment variable), but note that those using terminfo would not get notified.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.