This was an exercise I did one afternoon and never touched since.
But with the recent discussion in net.lang.c about setting environment
variables I thought I'd clean it up and post it.  (It hasn't been
tested in its' new form, hope I didn't break it! :-).

The routines work on 4.2BSD but should be portable to most systems.
(I believe system V uses the same format for environment variables).

On 4.2, the environment variables are stored in a global double dimensioned
character array pointed to by "environ".  The format of each entry
is "name=value".  All versions of exec() eventually end up calling
the same system call and give the environment as that pointed to
by "environ".

For programs which "know" what environ "looks like", these routines
almost exactly mimic that behavior.  The only way in which it doesn't
is the existance of "rstenv()" which makes us revert to our parent's
environment.  There is a possibility that (if you're adding these
routines to an existing program) that the program could get very
confused if a variable it added itself suddenly "went away".

The only other time a program could break would be if envp were
declared as an argument to main and saved/used elsewhere
independantly of environ.

	David Herron
	University of Kentucky, Computer Science
	cbosgd!ukma!david
	ukma!david@anl-mcs.arpa
