stty erase '^?' in v7

Random832 random832 at fastmail.com
Sat Oct 14 14:39:05 AEST 2017


On Fri, Oct 13, 2017, at 22:59, Will Senn wrote:
> Does anyone know why stty won't accept '^?' in v7? It will accept '^h', 
> but then the shell expects ^h to "backspace". I am trying to get the 
> delete key on my mac to do the backing up and it's '^?'. # isn't my 
> favorite since it's used in C programs, but pressing CTRL-h to backup is 
> a pain too. If you've read this far, I have three more questions:

First, you'd need to remove it as the *interrupt* character, which I
don't think the stty command in V7 can do, though the kernel supports it
with TIOCSETC. Signal characters are processed before input control
ones.

#include <sgtty.h>
struct sgttyb buf;
main() {
ioctl(1, TIOCSETC, "\3\34\21\23\4\377");
gtty(1, &buf);
buf.sg_erase = 0177;
buf.sg_kill = 025;
stty(1, &buf);
}

Also, it won't actually erase the character (unless your terminal
interprets an echoed ^? that way - to my knowledge only putty does) -
the crterase flag [and feature], which echoes space-backspace-space on
erase was added later than V7.

> 1. How do you escape # in order to write a C program if # is the erase 
> character in the terminal?

IIRC, it doesn't have effect on the first character of the line, which
is enough for C. Looking through the TTY driver, it looks like there's
code for backslash to escape it.

> 2. How do you enter a literal character in the v7 shell (I am used to 
> CTRL-v CTRL-DEL to enter the delete character on other unices)?

> 3. Is there a way to echo the ascii value of a keypress in v7?

You could probably put something together with stty raw, od, and sed q
(head didn't exist in v7, and you need *something* to cut things off
because ctrl-d won't work with stty raw), but it may be easier to figure
out what all your keys produce outside of your classic unix environment.



More information about the TUHS mailing list