diff options
author | yannicklm <yannicklm1337@gmail.com> | 2012-12-14 21:25:51 (GMT) |
---|---|---|
committer | yannicklm <yannicklm1337@gmail.com> | 2012-12-14 21:26:39 (GMT) |
commit | 6943f0537299e0d572b38b7d1e0562f0c13cb68e (patch) | |
tree | f1d73818462ceb3c0265457cdc11137df1cff095 /src/build.cc | |
parent | deb12d8eed547262719bd4d8b50f140b3dbdbc1e (diff) | |
download | Ninja-6943f0537299e0d572b38b7d1e0562f0c13cb68e.zip Ninja-6943f0537299e0d572b38b7d1e0562f0c13cb68e.tar.gz Ninja-6943f0537299e0d572b38b7d1e0562f0c13cb68e.tar.bz2 |
NINJA_STATUS: add support of `%p` for percentage
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/build.cc b/src/build.cc index 93ab10d..e5429cf 100644 --- a/src/build.cc +++ b/src/build.cc @@ -179,6 +179,7 @@ string BuildStatus::FormatProgressStatus( const char* progress_status_format) const { string out; char buf[32]; + int percent; for (const char* s = progress_status_format; *s != '\0'; ++s) { if (*s == '%') { ++s; @@ -231,6 +232,13 @@ string BuildStatus::FormatProgressStatus( out += buf; break; + // Percentage + case 'p': + percent = (100 * started_edges_) / total_edges_; + snprintf(buf, sizeof(buf), "%3i%%", percent); + out += buf; + break; + default: Fatal("unknown placeholder '%%%c' in $NINJA_STATUS", *s); return ""; |