www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/03/26/10:33:42

X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs
Date: Fri, 26 Mar 1999 16:32:27 +0100 (MET)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
X-Sender: broeker AT acp3bf
To: djgpp-workers AT delorie DOT com
Subject: Re: Bash 2.03 update (March 19th)
In-Reply-To: <199903260856.DAA22667@mescaline.gnu.org>
Message-ID: <Pine.LNX.3.93.990326162327.16984G-100000@acp3bf>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Fri, 26 Mar 1999, Eli Zaretskii wrote:

>    From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
> 
>    Just as an idea: in traditional DOS (i.e. command.com), program.bat is the
>    *last* thing that will be tried when you call 'program'. The command.com
>    search order is
[...]
> We do the same, we just append `program' at the end of this list.

And my point is that it should be somewhere else, probably next to
'program.exe'.

> You cannot do that on LFN systems, because `program' might be actually
> something like `foo.bar.bat', and to further complicate matters, there
> might be a program in the same directory called `foo.bar.bat.exe'.  

That's funny, indeed. OTOH, the traditional method is to not search for
any of the .com/.exe/.bat at all, if the program had been called with the
full filename, including extension. I.e.  calling 'foo.bat' would start
foo.bat, even if foo.com exists. Only exception from this rule (one I
forgot to mention in my first posting): command.com internal commands will
always be executed first, before any searching even in the current
directory is done. 

By extension, that'd mean that if I call `foo.bar.bat' and that file
exists, it should definitely be executed, and not `foo.bar.bat.exe'. 

> I
> know this is a bit perverse, but a user is entitled to have that.
> Moreover, there could be a directory `foo' and a program `foo.exe', in
> which case again it is better to try `foo.exe' first.

Directories are not an issue for the search. Only executable files really
come into play. After all, even `foo.exe' could be a directory. 

> And if that is not enough, running a raw COFF executable requires
> go32-v2 to be present, so if it is not available, you will fail;
> trying the .exe first works better in this case as well.

> So, on balance, I think trying with the extension first is a better way.

For the .com and .exe extensions, I partly agree. But not for the case
of .bat. They really shouldn't be executed if there's any other file
(in the same directory) that we can execute, instead. That'd imply
a search order

	foo.com
	foo.exe
	foo
	foo.bat

(and maybe add 'foo.sh' between foo an foo.bat ??)
 

Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019