Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!a.cs.uiuc.edu!bradley!brian From: brian@bradley.UUCP Newsgroups: comp.lang.c Subject: No fork() in MSC5.0, help... Message-ID: <9900005@bradley> Date: 18 Jul 88 12:27:00 GMT Lines: 30 Nf-ID: #N:bradley:9900005:000:1543 Nf-From: bradley.UUCP!brian Jul 18 07:27:00 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@seas.ucla.edu (309) 677-2230 ICBM: 40 40' N 89 34' W