rt/core: impl os::getcwd() in rust ref #4812
core: rt/core: impl os::env() in rust ref #4812
rt/core: port os::list_dir to rust ref #4812
auto merge of #5013 : olsonjeffery/rust/4812_work, r=brson

Happy Presidents' Day!

Four things:

- added `ptr::array_each()` to `core`, used to iterate over the elements in a `**T`. `ptr::array_each` assumes the provided array is null-terminated and determins length via `ptr::buf_len`. There is a `ptr:array_each_with_len` that takes a length parameter
- ported `os::get_cwd()` to rust, calling into C library fns in `core::libc`
- ported `os::env()` to rust. The win32 version uses API available in `libc::funcs::extra::kernel32`, while the *nix versions still use the `rust_env_pairs` in rt, which now just return the `**environ` (in platform applicable fashion).
- porting os::list_dir() to rust (unix is complete, windows complete)

The latter three are towards finishing #4812 .

core tests are passing in linux and OSX. I have an issue with my windows vm where rustc chews up and keeps hitting the 32bit process memory limit before segfaulting on one of the stage1 library builds. But I know that libcore builds on win32.