Mail Archives: djgpp-workers/2001/05/11/12:32:19
> > > What happens with lfnexe.bat.exe or lfnexe.foo.exe?
> >
> > gcc -o lfnexe.bat.exe lfnexe2.c
> >
> > >lfnexe.bat
> > Bad command or file name
I think you would get the same for lfnexe.exe if only lfnexe.exe.exe
exists.
>
> Then I think spawn*'s logic is better. It doesn't make sense, IMHO,
> to find a program lfnexe.foo.exe, but fail to find lfnexe.foo. If I
> replace the first dot with something else, as in lfnexe_foo, then both
> lfnexe_foo and lfnexe_foo.exe work. That is, COMMAND.COM (at least on
lfnexe.foo.exe would actually work; (for example, for hello.world.exe,
both 'hello.world' and 'hello.world.exe' run the executable).
Only if foo is exe/com/bat does command.com stop looking.
> Windows 98) treats the dot specially here, probably because someone
> left the old DOS logic intact.
>
> However, if there are specific problems with what spawn* does, please
> tell what they are.
>
Hmm - I think command.com's logic makes a lot of sense though.
From what has been posted it will look for <foo>.exe (and <foo>.bat, ...)
only if a) <foo> does not exist and b) <foo> does not already end in an
executable extension.
spawn seems to always tack on .exe/..., even if the extension is already
'executable'. I don't think it makes sense to try, say, foo.sh.exe before
trying foo.sh; the same should go for lfn.exe - you should only try
lfn.exe.exe if you're asked for it directly.
Basically, if I ask spawn to run <foo>, I expect it to run <foo> if it
exists, and try <foo>.exe if it doesn't, instead of running <foo>.exe
just because it exists.
- Raw text -