Pull some of the path handling code out of actions.cpp.
Add glob support.

This is based on Rene's implementation, but I used my own glob function,
and adjusted a few things since it's now always using ascii. It would be
nice to support unicode using utf-8, but that would require at a
normalization library, and perhaps much more than that.
Only match files when the whole glob matches.
Only run glob in existing directories.

Maybe it should be an error if there are no matches.
Fix the platform independent paths for globs.
Glob dependency tracking.
Error for invalid paths containing escaped slashes.

Note that the test cases are really awkward so this is unlikely to
actually happen normally, but implementation is much easier if it
doesn't have to worry about these cases.
Validate globs.
Handle non-globs containing escaped characters.
Make unicode globs invalid.
Partial support for unicode filenames in globs.

Globs are still ascii only, but just add a few extra checks to make sure
they don't do anything surprising when matching a well formed UTF-8
filename.