Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!mit-eddie!genrad!decvax!tektronix!puffin!dlu From: dlu@puffin.UUCP Newsgroups: comp.bugs.sys5 Subject: Re: Bug in vi or ksh? Message-ID: <10272@tektronix.TEK.COM> Date: Thu, 5-Feb-87 15:11:48 EST Article-I.D.: tektroni.10272 Posted: Thu Feb 5 15:11:48 1987 Date-Received: Sat, 7-Feb-87 16:39:49 EST References: <2063@ptsfa.UUCP> Sender: rad@tektronix.TEK.COM Reply-To: dlu@puffin.uss.tek.com (Doug Urner) Distribution: na Organization: Tektronix, Inc., Beaverton, OR. Lines: 42 What is happening, I think, is that you are running the "International Korn Shell" which uses an 8 bit character set. vi, erroneously I would say, passes the file name to the shell with the high bits set and the shell dutifully gets confused. There are two solutions - one is to fix vi, the other is to disable the recognition of 8 bit characters in ksh. I quote from the README in ../ksh-i/src: "This version passes 8-bit characters transparently. As a result programs which assume that the shell will strip off the 8th bit will fail. In particular, the vi command puts an 8th bit on the characters corresponding to % when invoking a shell. The best solution is to fix the vi command. However, if necessary, you can change the value of STRIP in sh/defs.h from 0377 to 0177 and rebuild a seven bit version of ksh-i." The following fragment from ex_unix.c *seems* to be the sight of the dirty deed (it was at line 74 on the 4.3beta version of ex): case '%': fp = savedfile; if (*fp == 0) { uxb[0] = 0; error("No filename@to substitute for %%"); } uexp: printub++; while (*fp) { if (up >= &uxb[UXBSIZE]) goto tunix; /* * setting QUOTE confuses ksh-i * *up++ = *fp++ | QUOTE; */ *up++ = *fp++; } The expansion of '#' uses this code too, so this should be the only place you need to fix. I haven't tested this yet, and I don't know why vi and friends think that it is reasonable but it sure looks like the place... Doug Urner dlu@puffin.USS.TEK.COM (503)627-5037