Split environment.c out of misc1.c

In the ongoing effort to reduce the number of loc in misc[12].c,
(see #209) this commit pulls a number of functions related to
reading, writing, and modifying environment variables from misc1.c
into a new module.
TODO:
  - fix warnings given by clint.py
  - make sure environment.c is actually the best place for all this
    code, maybe the homedir stuff should go into path.c?
  - write unittests?