[comp.lang.forth] "Shelling Out" to DOS

wmb@MITCH.ENG.SUN.COM (12/30/90)

> I keep reading about menuing systems that let you shell out while
> leaving only an 80-byte "tail" in memory so  you can return to the
> calling program when the child finishes running.  Does anybody have
> any idea exactly how this is done?  Is it something that could be
> done with forth?

Assuming that what you really want to do is to execute a program
"underneath" Forth and then return to Forth after it finishes, you
don't need to "shell out" in the sense of spawning a subordinate
COMMAND.COM "shell" program.  You can just execute the program directly
using the DOS "Exec" system call (DOS function 4B, subfunction 0).

About the only thing you lose by doing this is the ability to set
up pipelines with "|".  You would also lose I/O redirection ("<" and ">"),
but that would be easy enough to take care of in Forth.

Mitch Bradley, wmb@Eng.Sun.COM