Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!usc!ucla-cs!lanai!gast From: gast@lanai.cs.ucla.edu (David Gast) Newsgroups: comp.editors Subject: Re: :":!cc %" in vi. Message-ID: <28529@shemp.CS.UCLA.EDU> Date: 26 Oct 89 23:59:24 GMT References: <276@leo.UUCP> <2738@hydra.gatech.EDU> Sender: news@CS.UCLA.EDU Reply-To: gast@lanai.UUCP (David Gast) Distribution: na Organization: UCLA Computer Science Department Lines: 36 In article <2738@hydra.gatech.EDU> robert@shangri-la.gatech.edu (Robert Viduya) writes: >> >> Could anyone lights me up with this simple problem. >> While i was VIing a file, named foo.c, i tried to do: >> :!cc % >> i got the following error: >> "ld crt0.o fatal: Can't open file foo.c for input" >For some internal >reason, when vi substitutes the "%", it puts the current file name in with all >the characters having their high-bit set. You can't tell the difference on your >screen since that high-bit is used as a parity bit on serial lines and gets >filtered out, but when vi calls the shell to execute the command those bits >are in there and as a result, the compiler can't find the file. System V allows >you to have full 8-bit character file names and "foo.c" with the high-bit clear >is an entirely different name from "foo.c" with the high-bit set. > >The solution to the problem is to fix vi. If you don't have source and can't >do that, the next best solution is to fix your shell to filter out high-bits >(which prevents you from taking advantage of that feature). If you don't have source to vi or the shell or you just don't want to start hacking: 1) Use tr to clear the 8th bit. (I presume that Sys V can do this; I don't know for sure.) 2) Write a trival C program to clear the eighth bit. 3) Write a trivial shell program--call it ccc. Invoke it as :!ccc %. ccc passes its arguments through tr (from above) and then calls cc with the arguments you really want. Note: You don't filter the file through tr, you filter the arguments. David Gast gast@cs.ucla.edu {uunet,ucbvax,rutgers}!{ucla-cs,cs.ucla.edu}!gast