Path: utzoo!attcan!uunet!husc6!bu-cs!madd From: madd@bu-cs.BU.EDU (Jim Frost) Newsgroups: comp.sys.ibm.pc Subject: Re: Expanding Environment on a Z-158 (a follow-up) Message-ID: <23786@bu-cs.BU.EDU> Date: 12 Jul 88 03:53:20 GMT References: <3705@ece-csc.UUCP> Reply-To: madd@bu-it.bu.edu (Jim Frost) Followup-To: comp.sys.ibm.pc Organization: Boston University Distributed Systems Group Lines: 101 In article <3705@ece-csc.UUCP> kwf@ece-csc.UUCP (Kenneth W. Fernald) writes: |I have received several suggestions, all of which recommend using |the /E:XXX option of the COMMAND.COM (using the SHELL= command). |Although I am grateful for those individual's interest and help, I failed |to mention in my original question that my Zenith version of MS-DOS 3.1 |doesn't appear to support the /E option. It is not documented, and when I |attempt to use it, no apparent change in environment size occurs. Zenith's isn't the only version with this problem. Our true-blue version of PC-DOS 3.10 refuses to believe the /e option. Mostly I've gotten around this by using my own shell, but there are many cases where that just isn't a good idea. How can you fix it? One easy way to do it (at the cost of some memory) would be to run a small program which sets environment variables for itself and then runs command.com. For example: { envmake.pas: this is a Turbo Pascal 4.0 program that is supposed to set up an environment before calling command.com to allow for large environments. it has not been tested but it should give you an idea. this program is in the public domain. written by jim frost on 7.11.88. comments to madd@bu-it.bu.edu } {$m 1024,0,0 } program envmake; const prog = 'envmake'; fname = '\envmake.def'; elen = 1023; type str = string[255]; var env : array[0..1024] of char; { environment area } ptr : integer; { ptr in environment area } eseg, { segment addr of environment } eofs : word; { offset addr of environment } f : text; { file to get defs from } { add to the environment buffer } procedure addenv(s : str); var eq : boolean; a : integer; begin if ptr+length(s)+2 > elen then begin writeln(prog,': environment area full'); exit end; eq:= false; for a:= 1 to length(s) do begin if s[a] = '=' then eq:= true; if not eq then { capitalize up to '=' } env[ptr]:= upcase(s[a]); else env[ptr]:= s[a]; inc(ptr) end; env[ptr]:= #0; { terminate string } inc(ptr); env[ptr]:= #0 { terminate environment } end; begin eseg:= seg(env)+(ofs(env) mod 16); eofs:= ofs(env) mod 16; if eofs <> 0 then begin { adjust into buffer for paragraph alignment } inc(eseg); ptr:= 16 - eofs end; memw[prefixseg:$2c]:= eseg; { tell dos about it } { environment is now at env[ptr], so fill it } assign(f,fname); reset(f); if ioresult <> 0 then writeln(prgname,': could not open ',fname) else begin while not eof(f) do begin readln(f,s); addenv(s) end; close(f) end; exec('\command.com','/p'); writeln('exec: command.com execution failure (',doserror,')'); repeat until false end. Put that in the shell= portion of config.sys. I think it'll work, but I don't have a compiler or machine to test it on. Happy hacking, jim frost madd@bu-it.bu.edu