The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: don@DonHopkins.com (Don Hopkins)
Subject: [TUHS] Literal character escapes in v7
Date: Tue, 7 Nov 2017 16:33:59 +0100	[thread overview]
Message-ID: <B9D2B3E9-B21A-48E8-AC8F-0A4E0AC39FEA@gmail.com> (raw)
In-Reply-To: <b72ba3f2-5f38-6194-4925-b3b9e0caf4b9@gmail.com>

I have always been a proponent of generalizing /dev/zero such that it supports both block and character mode, and the minor node number specifies the byte you get mapped into memory or read from a file.

So then you could just make a character device /dev/backspace whose minor node number was 8, and /dev/beep whose minor node number was 7! 

-Don

> On 7 Nov 2017, at 05:21, Will Senn <will.senn at gmail.com> wrote:
> 
> I wrote a snippet from my K&R C studies to convert tabs and backspaces to \t \b to display them, the code looks like this:
> 
> /* ex 1-8 */
> 
> main()
> {
>     int c, sf;
> 
>     while((c = getchar()) != EOF) {
>         if(c == '\t')
>             printf("\\t");
>          if(c == '\b')
>             printf("\\b");
>         else
>             putchar(c);
>     }
> }
> 
> 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 :).
> 
> Thanks,
> 
> Will
> 
> -- 
> GPG Fingerprint: 68F4 B3BD 1730 555A 4462  7D45 3EAA 5B6D A982 BAAF
> 



  parent reply	other threads:[~2017-11-07 15:33 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
2017-11-07 11:21 ` Dan Cross
2017-11-07 14:59   ` Will Senn
2017-11-07 15:33 ` Don Hopkins [this message]
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=B9D2B3E9-B21A-48E8-AC8F-0A4E0AC39FEA@gmail.com \
    --to=don@donhopkins.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).