Split file into parts with and without substitutions.

At this point, there are no functional changes.  This just prepares
the way for future work.
Make sure the PWD environment variable points to the t directory.

runtests is typically run under /bin/sh.  If the user uses a different
interactive shell (such as /bin/ksh) that maintains the PWD environment
variable, but /bin/sh does not, then the 'cd t' line in runtests ends
up changing the working directory without updating $PWD.  Several tests
in t/io/fs.t rely on being able to change directories and then get back
to the original.  The tests assume that if $PWD is set at all, then
it is set correctly.  This fix changes runtests to ensure it is so.