From: will.senn@gmail.com (Will Senn)
Subject: [TUHS] Literal character escapes in v7
Date: Tue, 7 Nov 2017 07:55:49 -0600 [thread overview]
Message-ID: <3657a548-46be-0a7a-c092-af5979f36334@gmail.com> (raw)
In-Reply-To: <20171107090723.F2CC3A585D1@yagi.h-net.msu.edu>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]
On 11/7/17 3:07 AM, Dennis Boone wrote:
> > I'm not looking for code review, but the code is intended to replace
> > the tabs and backspaces with \t and \b respectively, but I haven't
> > been able to test it because I can't seem to make a backspace
> > character appear in input. In later unices, ^V followed by the
> > backspace would work, but that's not part of v7. Backspace itself is
> > my erase character, so anytime I just type it, it backspaces :).
>
> This bit from the middle of sys/dev/tty.c seems to indicate that you
> escape it with \:
>
> } else {
> mc = maptab[c];
> if (c==tp->t_erase || c==tp->t_kill)
> mc = c;
> if (mc && (mc==c || (tp->t_flags&LCASE))) {
> if (bp[-2] != '\\')
> c = mc;
> bp--;
> }
> }
>
> On my test v7 system if I type backslash control-h:
>
> # stty
> speed 0 baud
> erase = '^H'; kill = '^U'
> even -nl echo -tabs
> # echo \^H | od -c
> 0000000 \b \n
> 0000002
> #
>
> De
Thanks for the note. I thought about it and tried it out even though I
don't see the ^H (my cursor backs up a space).
After typing echo "\^H" | od -c, here's what it looks like:
$ echo "" | od -c
0000000 \b \n
0000002
So, sure enough there's a backspace in there and my code "sees" it too:
$ echo "" | 1-8
<<BACKSPACE>>
$
--
GPG Fingerprint: 68F4 B3BD 1730 555A 4462 7D45 3EAA 5B6D A982 BAAF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20171107/34432d5e/attachment.html>
next prev parent reply other threads:[~2017-11-07 13:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-07 4:21 Will Senn
2017-11-07 4:34 ` arnold
2017-11-07 4:49 ` Will Senn
2017-11-07 5:00 ` Will Senn
2017-11-07 8:08 ` arnold
2017-11-07 9:07 ` Dennis Boone
2017-11-07 13:55 ` Will Senn [this message]
2017-11-07 11:21 ` Dan Cross
2017-11-07 14:59 ` Will Senn
2017-11-07 15:33 ` Don Hopkins
2017-11-08 16:48 ` Ralph Corderoy
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=3657a548-46be-0a7a-c092-af5979f36334@gmail.com \
--to=will.senn@gmail.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).