www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/01/03/07:15:26

From: mcastle AT cs DOT umr DOT edu
Subject: Re: environment and system calls
To: alane AT wozzle DOT linet DOT org (J. Alan Eldridge)
Date: Sun, 3 Jan 93 5:23:04 CST
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

Amazingly enough J. Alan Eldridge said:
> Eric Backus <src4src!mcdhup!rutgers!lsid.hp.com!ericb> writes:
> > 
> > It seems like we could make a new "turbo-assist" entry for setenv(),
> > to set go32's environment and thus the child's environment.  Would
> > this leave the parent's environment modifies when go32 exits?  If so,
> > we'd have to work around that somehow.
> 
> Yes, we could do that... _but_ there's no spare environment space to
> modify (thank you MSDOS). When DOS spawns a child process, and in this
> case go32 is a child of the command processor, it only allocates as
> many bytes as are used in the parent's environment, not the number 
> specified for the master environment in config.sys. This is a defect in
> DOS, and I'm not sure of a good workaround.

What about spawn[lpv]e()?  the 'e' is for environment.  Doesn't that
allow use (this is from turbo c, of course) to use putenv() to modify
the the process environment, then pass that to the child process?

From Turbo 1.0 docs:

	e	The argument envp can be passed to the child process, allowing
		you to alter the environment for the child process.  Without
		the e suffix, child processes inherit the environment of the 
		parent process.

I don't have turbo installed (and not the free space to do it) and campus
is locked up tight at the moment, so I can't test this out.  

mrc
--
Mike Castle .-=NEXUS=-.  Life is like a clock:  You can work constantly
  mcastle AT cs DOT umr DOT edu     and be right all the time, or not work at all
S087891 AT UMRVMA DOT UMR DOT EDU   and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019