From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: beta12: 8-bit-cleanliness
Date: Thu, 23 Nov 1995 10:08:43 +0100 [thread overview]
Message-ID: <9511230908.AA13665@sgi.ifh.de> (raw)
In-Reply-To: "a.main@dcs.warwick.ac.uk"'s message of "Wed, 22 Nov 1995 13:13:10 MET." <5178.199511221313@stone.dcs.warwick.ac.uk>
a.main@dcs.warwick.ac.uk wrote:
> >... nicefputs() ... niceputc() ...
>
> You'll want to modify nicestrlen() as well.
Thanks. Here's the complete patch for all three routines.
*** Src/utils.c.nice Tue Nov 21 06:39:31 1995
--- Src/utils.c Thu Nov 23 09:50:15 1995
***************
*** 145,150 ****
--- 145,158 ----
return;
}
c &= 0xff;
+ if (c & 0x80)
+ if (isprint(c & ~0x80)) {
+ putc(c, f);
+ return;
+ } else {
+ fputs("\\M-", f);
+ c &= ~0x80;
+ }
if (isprint(c)) {
putc(c, f);
} else if (c == '\n') {
***************
*** 164,180 ****
nicefputs(char *s, FILE *f)
{
for (; *s; s++) {
! if (isprint(*s))
! putc(*s, f);
! else if (*s == '\n') {
putc('\\', f);
putc('n', f);
! } else if(*s == '\t') {
putc('\\', f);
putc('t', f);
} else {
putc('^', f);
! putc(*s ^ 0x40, f);
}
}
}
--- 172,197 ----
nicefputs(char *s, FILE *f)
{
for (; *s; s++) {
! char c = *s;
! if (c & 0x80)
! if (isprint(c & ~0x80)) {
! putc(c, f);
! continue;
! } else {
! fputs("\\M-", f);
! c &= ~0x80;
! }
! if (isprint(c))
! putc(c, f);
! else if (c == '\n') {
putc('\\', f);
putc('n', f);
! } else if(c == '\t') {
putc('\\', f);
putc('t', f);
} else {
putc('^', f);
! putc(c ^ 0x40, f);
}
}
}
***************
*** 185,192 ****
{
size_t l = 0;
! for(; *s; s++)
! l += 1 + !isprint(*s);
return l;
}
--- 202,212 ----
{
size_t l = 0;
! for(; *s; s++) {
! if ((*s & 0x80) && !isprint(*s & ~0x80))
! l += 3;
! l += 1 + !isprint(*s & ~0x80);
! }
return l;
}
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
next prev parent reply other threads:[~1995-11-23 9:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-11-22 3:02 Thorsten Meinecke
1995-11-22 9:19 ` Zoltan Hidvegi
1995-11-22 9:33 ` P.Stephenson
1995-11-22 13:13 ` Zefram
1995-11-23 9:08 ` Peter Stephenson [this message]
1995-11-24 21:29 ` Thorsten Meinecke
1995-11-25 5:00 ` Zefram
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=9511230908.AA13665@sgi.ifh.de \
--to=pws@ifh.de \
--cc=zsh-workers@math.gatech.edu \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).