Implement chdir()

Adds chdir(2) in a straightforward way. Fixes #13.