www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/06/12:26:05

Message-Id: <199908061553.PAA52260@out5.ibm.net>
From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Fri, 6 Aug 1999 11:52:03 -0400
MIME-Version: 1.0
Subject: possible bug in spawn*
X-mailer: Pegasus Mail for Win32 (v3.11)
Reply-To: djgpp-workers AT delorie DOT com

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...)? The source does convert the 
program to c:/... form, but not until after the path has been copied to argv[0]. Is 
this intentional or is this a bug?

Here's how I tested:

test parent program:
#include <process.h>

int main()
{
  spawnl(P_WAIT, "/dev/c/djgpp/bin/argv0.exe", "c:/djgpp/bin/argv0.exe", NULL);
  return 0;
}

test child program, argv0:
#include <stdio.h>

int main(int argc, char **argv)
{
  printf("argv0: %s\n", argv[0]);
}

You will find that argv[0] will be in the '/dev/' form.

--- 
Mark Elbrecht, snowball3 AT bigfoot DOT com
http://snowball.frogspace.net/

- Raw text -


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