Move all target so it is the default.
Use lstat64 as we do elsewhere.
Use readdir lstat buf.

Partially fixes #374.
Wrong type for chirp_transient_path.
Use an array instead.
Add slash so file://a/dir will work.

That is, allow the URL to not end with a '/'.
Use curl instead of wget so file:// URLs work.
Merge branch 'batrick-374-bugfix'

Fixes #374.