delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/08/11:51:08

Date: Sun, 8 Aug 1999 14:24:11 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Mark E." <snowball3 AT bigfoot DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: possible bug in spawn*
In-Reply-To: <199908061553.PAA52260@out5.ibm.net>
Message-ID: <Pine.SUN.3.91.990808142351.23423e-100000@is>
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, 6 Aug 1999, Mark E. wrote:

> If I run a program and the program name is in the '/dev/' format,
> shouldn't argv[0] be converted to regular DOS format (c:/djgpp/bin...)? 

I don't know.  Why should it?  Does it break something?  In my testing
I didn't have any problems with `spawn*' and /dev/foo names.  (There's
a special test program in djtst203.zip written specifically to test
all library functions that accept file names, including spawnXX.)

In general `spawn*' leaves argv[0] as it was passed by the caller,
which is the reason why sometimes it is passed without the leading
directories.  It's an old issue which we decided not to touch when
v2.01 was in beta.

In this case, converting the name back to c:/foo form might fail in
some cases, if the invoked program doesn't like the DOS drive letter
braindamage.

> The source does convert program to c:/... form, but not until after
> the path has been copied to argv[0].

The program pathname is converted to the usual DOS form (by calling
`_put_path2') because otherwise DOS won't find it: it doesn't know
about all that /dev/foo magic.  Note that what's converted is NOT
argv[0], which is in a different string: the caller should be able to
pass two different strings in argv[0] and in the actual program name.

- Raw text -


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