www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/14/17:50:08

From: Oded Nissan <oded AT memco DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Determining the path of the executable at runtime
Date: Wed, 10 Sep 1997 16:35:30 +0300
Organization: Unspecified Organization
Lines: 24
Message-ID: <Pine.A32.3.91.970910163020.13502G-100000@fortis.memco.co.il>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970907130243 DOT 2248C-100000 AT is>
NNTP-Posting-Host: cirithungol.memco.co.il
Mime-Version: 1.0
In-Reply-To: <Pine.SUN.3.91.970907130243.2248C-100000@is>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sun, 7 Sep 1997, Eli Zaretskii wrote:

> 
> It's not.  ANSI leaves this very vague indeed.  It says argv[0] is the
> name of the program, but doesn't specify how precise that name should
> be.  It even allows the name to be an empty string "".
>
That's because it is up to the OS's spawn or exec function to pass the 
parameters to the executing program.
In DOS the command line params are read from the program's psp.

 
> On a more practical note, some Unix shells only return the program
> name as typed on the command line.  For example, if you typed "foo bar"
> and the program `foo' was found along the PATH, you will only have
> "foo" as argv[0]. 

AFAIK this applies to DOS as well.
It depends on the OS implementation.

> Programs that need to know the exact file name
> of their executable should also look along the PATH to handle such
> shells (for example, Emacs does that at startup).
> 

- Raw text -


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