Mail Archives: djgpp-workers/2001/05/08/18:00:54
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 -