The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: random832@fastmail.com (Random832)
Subject: stty erase '^?' in v7
Date: Sat, 14 Oct 2017 00:39:05 -0400	[thread overview]
Message-ID: <1507955945.3625743.1138420416.3859F903@webmail.messagingengine.com> (raw)
In-Reply-To: <8de0efc7-0a45-02f2-5db3-7b3bbbe4b815@gmail.com>

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.


  parent reply	other threads:[~2017-10-14  4:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-14  2:59 Will Senn
2017-10-14  4:08 ` Grant Taylor
2017-10-14  4:39 ` Random832 [this message]
2017-10-14  5:03   ` Will Senn
2017-10-16 14:46     ` Random832
2017-10-14  4:25 Noel Chiappa
2017-10-14  4:48 ` Will Senn
2017-10-14  6:31 ` Dave Horsfall
2017-10-14 14:03   ` Will Senn
2017-10-14 22:01     ` Dave Horsfall
2017-10-14 12:52 Noel Chiappa
2017-10-14 14:40 ` Clem Cole
2017-10-14 14:44   ` Ronald Natalie
2017-10-15 13:10     ` Don Hopkins
2017-10-15 14:39 Noel Chiappa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507955945.3625743.1138420416.3859F903@webmail.messagingengine.com \
    --to=random832@fastmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).