The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Literal character escapes in v7
@ 2017-11-07  4:21 Will Senn
  2017-11-07  4:34 ` arnold
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Will Senn @ 2017-11-07  4:21 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

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



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-11-08 16:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-07  4:21 [TUHS] Literal character escapes in v7 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
2017-11-08 16:48 ` Ralph Corderoy

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).