Mail Archives: djgpp/1997/04/14/06:57:29
On Mon, 14 Apr 1997, Chris Croughton wrote:
> The bit which prints "Hello" is the child, but it isn't a separate
> program it's part of the same one. I don't mind whether the child
> finishes before the parent continues (which it might even in a true
> multitasking environment), I do want it to run in the same program
> as the parent.
I know what `fork' does on Unix. What I don't understand is what is so
important about the precise way `fork' works that you need to duplicate
it in DJGPP. If you are willing to wait until the child exits, why can't
you just spawn the same program, like so:
int main (int argc, char *argv[])
{
if (argc == 1)
{
return spawnlp (P_WAIT, argv[0], argv[0], "Hello world!", 0);
}
else
{
printf("%s", argv[1]);
return 0;
}
}
> The misunderstanding, I suspect, is because I was using the term 'child'
> in the Unix sense and you read it in the DOS one. Or Maybe Not.
No, they are still called `child processes' on Unix, so this is not the
source of the misunderstanding. I just don't understand what is it that
you value so much in the peculiar way `fork' works on Unix.
- Raw text -