More robust escaping of $in, $out paths

See issue #689. I ensure that paths without special characters aren't escaped 'unnecessarily' -- this is unfortunate, it'd be simpler and potentially faster to escape unconditionally. It's necessary at present so as to not break `depfile` any more than it already is (see <https://groups.google.com/forum/#!topic/ninja-build/Gruyqo8IPU0/discussion>).

`measure.py ninja -n` in chromium source tree:

master:
~~~
sampling: 868ms 848ms 828ms 817ms 821ms 825ms 820ms 857ms 833ms 824ms
estimate: 817ms (mean err 17.0ms)
~~~

this patch:
~~~
sampling: 852ms 847ms 832ms 826ms 823ms 837ms 837ms 832ms 824ms 827ms 
estimate: 823ms (mean err 10.7ms)
~~~