portable pushd/popd implementations