delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/05/08/18:00:54

From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Tue, 8 May 2001 17:57:14 -0400
MIME-Version: 1.0
Subject: spawn* and LFN again
Message-ID: <3AF8337A.4152.2ADA56@localhost>
X-mailer: Pegasus Mail for Win32 (v3.12c)
Reply-To: djgpp-workers AT delorie DOT com

Hi guys,
Is the extension search in dosexec.c:__spawnve() supposed to emulate how 
command.com finds extensions? If so, I've found a difference in the 
emulation. I tested command.com (win98se's version) with the following short 
program:

lfnexe.c:
#include <stdio.h>

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

  return 0;
}

then
gcc -o lfntest.exe lfntest.c

Then make a slight alteration to make lfntest2.c:

#include <stdio.h>

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

  return 0;
}

Then compile:
gcc -o lfntest.exe lfntest.c
gcc -o lfntest.exe.exe lfntest2.c

Results from the command line:
>lfnexe
argv0: d:/djgpp/projects/lfnexe/lfnexe.exe
>lfnexe.exe
argv0: d:/djgpp/projects/lfnexe/lfnexe.exe
>lfnexe.exe.exe
lfnexe.exe.exe argv0: d:/djgp/pprojects/lfnexe/lfnexe~1.exe

But spawn finds 'lfnexe.exe.exe' when given 'lfnexe.exe':
#include <stdio.h>
#include <process.h>

int main()
{
  spawnl (P_WAIT, "lfnexe", "lfnexe", NULL);
  spawnl (P_WAIT, "lfnexe.exe", "lfnexe.exe", NULL);
  spawnl (P_WAIT, "lfnexe.exe.exe", "lfnexe.exe.exe", NULL);

  return 0;
}

It's output:

argv0: lfnexe.exe
lfnexe.exe.exe argv0: lfnexe.exe.exe
lfnexe.exe.exe argv0: lfnexe.exe.exe

If DJGPP is emulating command.com behavior, then the case lfnexe.exe.exe is 
executed when given lfnexe.exe needs to be fixed.

- Raw text -


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