No fork() in MSC5.0, help...
brian at bradley.UUCP
brian at bradley.UUCP
Mon Jul 18 22:27:00 AEST 1988
I'm considering writing a shell for the IBM PC... I'm using Microsoft
C 5.0. This version does not provide a fork() function. Instead, they
provide a set of functions called spawn, which are similar to exec.
That is, there is a spawnve(), spawnl(), etc. Their effect is similar
to a fork(), with an exec() in the child process, and a wait() in the
parent process.
Unfortunatley, to do I/O redirection, I need to put some code between
the fork() and the exec() in the child process. Since there is not
really a fork(), this isn't possible.
Of course, I could do a system() with my whole command line, but this
is not a solution because 1) there is no way to pass the environment
in this case, 2) I would have to somehow translate my shell's syntax
back to MS-DOS COMMAND.COM syntax, which may not be possible, and
3) the system() function probaly will load in another copy of COMMAND.COM,
and my shell will be cutting into avaible memory at it is.
So what I need is a way to run a child process, with (possibly)
redirected input and/or output, passing the environment, and having the
parent process resume execution after the child process completes.
Does anyone have any clues as to how this can be done?
...............................................................................
When the going gets weird, the weird turn pro.
Brian Michael Wendt UUCP: {cepu,ihnp4,uiucdcs,noao}!bradley!brian
Bradley University ARPA: cepu!bradley!brian at seas.ucla.edu
(309) 677-2230 ICBM: 40 40' N 89 34' W
More information about the Comp.lang.c
mailing list