Last active
April 7, 2020 00:53
-
-
Save ehanneken/2413ec505a1e9c18f80a7fd3a081b99e to your computer and use it in GitHub Desktop.
Make the backspace key work in the Unix V7 terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /usr | |
ed ./src/cmd/getty.c <<'EOE' | |
12c | |
struct tchars tchars = { '\003', '\034', '\021', '\023', '\004', '\377' }; | |
. | |
8,9c | |
#define ERASE '\177' | |
#define KILL '\025' | |
. | |
w | |
q | |
EOE | |
ed ./src/cmd/login.c <<'EOE' | |
46,47c | |
ttyb.sg_erase = 0177; | |
ttyb.sg_kill = 025; | |
. | |
w | |
q | |
EOE | |
ed ./sys/dev/tty.c <<'EOE' | |
559a | |
* DEL is just a very fancy backspace today. | |
* However, just reducing colp by one is insufficient. | |
* We need to send an actual ^H. | |
* We're taking this opportunity to also rub out the | |
* previous character. | |
*/ | |
if (c==0177) { | |
ttyoutput(010, tp); | |
ttyoutput(' ', tp); | |
ttyoutput(010, tp); | |
return; | |
} | |
/* | |
. | |
w | |
q | |
EOE | |
ed ./sys/h/tty.h <<'EOE' | |
84c | |
#define CINTR 003 /* ctl-c */ | |
. | |
82c | |
#define CKILL 025 | |
. | |
80c | |
#define CERASE 0177 /* default special characters */ | |
. | |
w | |
q | |
EOE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /usr | |
ed ./src/cmd/getty.c <<'EOE' | |
12c | |
struct tchars tchars = { '\177', '\034', '\021', '\023', '\004', '\377' }; | |
. | |
8,9c | |
#define ERASE '#' | |
#define KILL '@' | |
. | |
w | |
q | |
EOE | |
ed ./src/cmd/login.c <<'EOE' | |
46,47c | |
ttyb.sg_erase = '#'; | |
ttyb.sg_kill = '@'; | |
. | |
w | |
q | |
EOE | |
ed ./sys/dev/tty.c <<'EOE' | |
560,572d | |
w | |
q | |
EOE | |
ed ./sys/h/tty.h <<'EOE' | |
84c | |
#define CINTR 0177 /* DEL */ | |
. | |
82c | |
#define CKILL '@' | |
. | |
80c | |
#define CERASE '#' /* default special characters */ | |
. | |
w | |
q | |
EOE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See Teaching an Almost 40-year Old UNIX about Backspace, by xorhash. I just turned his work into a script. uv7patch.sh patches the source code. uv7unpatch.sh undoes the patch.