Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!sri-unix!rutgers!mcnc!ece-csc!ncrcae!ncr-sd!hp-sdd!hplabs!hpcea!hpsrla!hpsrlc!darrylo From: darrylo@hpsrlc.HP.COM (Darryl Okahata) Newsgroups: comp.sys.ibm.pc Subject: Re: Environment settings from a C program Message-ID: <3320061@hpsrlc.HP.COM> Date: Sat, 17-Oct-87 15:28:42 EDT Article-I.D.: hpsrlc.3320061 Posted: Sat Oct 17 15:28:42 1987 Date-Received: Sun, 18-Oct-87 23:48:43 EDT References: <700@hsi.UUCP> Organization: HP Network Measurements Div - Santa Rosa, CA Lines: 43 In comp.sys.ibm.pc, paula@bcsaic.UUCP (Paul Allen) writes: > In article <700@hsi.UUCP>, mark@hsi.UUCP (Mark Sicignano) writes: > >I am trying to change an environment variable from within > >a Turbo-C program. Turbo-C provides a function, putenv() > >which will make changes to, add, or delete environment, > >but any changes are made to the environment within the program, > >and for child processes. > > > >I need for these changes to remain. Is it possible? > > I've seen several responses to this, ranging from "It's impossible" to > "here's a PD program that does it". So far, noone has mentioned > undocumented interrupt 1EH. This interrupt takes as an argument a [ ... ] > Caveats: > > I have used this undocumented feature, and it works, but it is probably > undocumented for a reason. I am working from memory, or I could tell [ ... ] > > Paul Allen > paula@boeing.com > ...!uw-beaver!ssc-vax!bcsaic!paula > ---------- Int 2EH only seems to change the environment of the topmost invocation of command.com. For example, if you run another copy of command.com, and run a program which changes the environment via Int 2EH, you will find that the environment of the second copy of command.com has not changed. You will have to EXIT the second copy before the changes will become visible. Also, if I remember correctly, Int 2EH destroys ALL registers, including those of the STACK. Yuk! -- Darryl Okahata {hplabs!hpccc!, hpfcla!} hpsrla!darrylo CompuServe: 75206,3074 Disclaimer: the above is the author's personal opinion and is not the opinion or policy of his employer or of the little green men that have been following him all day.