From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id UAA29770 for ; Thu, 23 Nov 1995 20:31:07 +1100 (EST) Received: by math.gatech.edu (5.x/SMI-SVR4) id AA27587; Thu, 23 Nov 1995 04:08:42 -0500 Resent-Date: Thu, 23 Nov 1995 10:08:43 +0100 Old-Return-Path: Message-Id: <9511230908.AA13665@sgi.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: beta12: 8-bit-cleanliness 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> Date: Thu, 23 Nov 1995 10:08:43 +0100 From: Peter Stephenson Resent-Message-Id: <"ndooT1.0.zk6.Qe3jm"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/635 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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 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.