The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: will.senn@gmail.com (Will Senn)
Subject: [TUHS] Literal character escapes in v7
Date: Tue, 7 Nov 2017 08:59:47 -0600	[thread overview]
Message-ID: <3708707e-43de-4dc6-ebfe-6b8ec1d4a572@gmail.com> (raw)
In-Reply-To: <CAEoi9W6sBM3nt9ETvCALY0_NU2yEPO6KcD8_z8YCFHmOr+B8bQ@mail.gmail.com>

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


>
>          while((c = getchar()) != EOF) {
>              if(c == '\t')
>                  printf("\\t");
>               if(c == '\b')
>
>
> Shouldn't this be 'else if'? Otherwise, if you encounter a tab, you 
> will print '\t' and then call into the 'else' below after the test for 
> '\b' and print c, which is a tab literal.
>
>         - Dan C.
>
>
Yes it should - I was concentrating on the backspace thing and not being 
careful enough about the code.

        if(c== '\t')
            printf("\\t");
        else if(c == '\b')
            printf("\\b");
        else
            putchar(c);

Thanks,
Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20171107/b700f995/attachment.html>


  reply	other threads:[~2017-11-07 14:59 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 [this message]
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=3708707e-43de-4dc6-ebfe-6b8ec1d4a572@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).