Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: beta12: 8-bit-cleanliness
- X-seq: zsh-workers 635
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: beta12: 8-bit-cleanliness
- Date: Thu, 23 Nov 1995 10:08:43 +0100
- In-reply-to: "a.main@xxxxxxxxxxxxxxxxx"'s message of "Wed, 22 Nov 1995 13:13:10 MET." <5178.199511221313@xxxxxxxxxxxxxxxxxxxxxxx>
a.main@xxxxxxxxxxxxxxxxx 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@xxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author