Adding error checking on fwrite/fflush in deps_log
Adding checks for record overflow in deps_log
Reuse ManifestParser::Load() in ManifestParser::ParseFileInclude().

ParseFileInclude() was doing the work that Load() was doing. Instead, just
make it call Load().

Also, remove a FIXME about using ReadPath() in ParseFileInclude() -- it's
already being used. (The FIXME was added in the same commit that added the
call to ReadPath() -- 8a0c96075786c19 -- it probably should've been deleted
before that commit.)

Also, remove a `contents.resize(contents.size() + 10);`. It's not clear what
it's for, but if it was important then ManifestParser::ParseFileInclude()
would have needed that call too, and it didn't have it.

No intended behavior change.
Let the ".ninja parse" metric include the time to read the toplevel ninja file.

Loads of included ninja files were covered by the ".ninja parse" in Parse()
further up the stack from the toplevel file, but the load of the toplevel
file wasn't counted. Fix that.
Add back contents.resize(), but with a comment and just 1 instead of 10.
Merge pull request #621 from nico/ninjaload

Reuse ManifestParser::Load() in ManifestParser::ParseFileInclude().
Add test for a manifest ending in the middle of a keyword.
Merge pull request #622 from nico/test

Add test for a manifest ending in the middle of a keyword.
Fix diagnostic formatting regression caused by adaa91a33eb2cf23b88.

Ninja regressed to include a location for every file on the include stack for
nested diagnostics, i.e. it would print:

  input:1: include.ninja:1: expected path

Fix this so that it prints only the current file location, like it used to:

  include.ninja:1: expected path

Also add a test for this.
Merge pull request #623 from nico/fix

Fix diagnostic formatting regression caused by adaa91a33eb2cf23b88.
Removing a redundant stat() call with 'deps' and 'restat = 1'
minor: removing noop call to MarkDirty(), fixing comment
Merge pull request #624 from nico/landmaxim

Land the first two commits of pull request #608.
Fix restat dirty check logic for edges with multiple outputs

In a normal dependency scan (see DependencyScan::RecomputeDirty) we mark
all outputs of an Edge as dirty if any of the outputs is dirty.  This is
the correct behavior because if any output is dirty, we will run the
command for that Edge and that can touch any of the outputs of the Edge
and so all the outputs should be marked dirty.

When updating the dirty state of Node's for a restat check, we were not
applying this logic, instead only those outputs that were actually
"dirty" were marked dirty.

Before this patch, restat edges with multiple outputs caused not all
dependent edges to run.
Add test for correct restat logic

When a single output of an edge is dirty, the restat check should
leave all outputs of that edge dirty.
Merge pull request #625 from nico/land

Merge pull request #617.
Merge pull request #612 from maximuska/proposed/deps_log_write_errors_checking

Proposed/deps log write errors checking
Build log write error checking.

Like f6f00aa40f0c541df06, but for the build log instead of the deps log.
Merge pull request #626 from nico/logwrite

Build log write error checking.
Fix the browse tool.

ReadFlags was altering argv in real_main causing us
to pass the wrong value into the NinjaMain constructor.
Fix this by storing the ninja command before real_main
runs.