Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!gatech!prism!robert@shangri-la.gatech.edu From: robert@shangri-la.gatech.edu (Robert Viduya) Newsgroups: comp.editors Subject: Re: :":!cc %" in vi. Message-ID: <2738@hydra.gatech.EDU> Date: 24 Oct 89 13:40:51 GMT References: <276@leo.UUCP> Sender: news@prism.gatech.EDU Reply-To: robert@shangri-la.gatech.edu (Robert Viduya) Distribution: na Organization: Office of Computing Services, Georgia Tech Lines: 40 > > 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" > but if i did: > :!cc foo.c > then everything was fine. It seems to me that the shell substituted '%' for > the current file name correctly, but the search path was somewhere else!!! > Some corrections: it's vi that substitutes "%" with the current file name, not the shell and there's nothing wrong with the search path. 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. That's also the reason why ld generated the error message and not cc or cpp or ccom. The compiler looks for a ".c" with the high-bit clear to determine if the file is C source (as well as other "." extensions for other file types); anything it doesn't recognize gets passed to ld. 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've got the Korn shell, there is a compile time flag as well as a few comments in the installation documentation that tell you why and how to use it. robert -- Robert Viduya robert@shangri-la.gatech.edu Office of Computing Services Georgia Institute of Technology (404) 894-6296 Atlanta, Georgia 30332-0275