diff options
author | Felix Buehler <account@buehler.rocks> | 2018-06-02 02:32:25 +0200 |
---|---|---|
committer | Felix Buehler <account@buehler.rocks> | 2018-07-13 15:03:31 +0200 |
commit | 52e9f6f63b74db2a6a1d67524851649b18794950 (patch) | |
tree | 5f6ab7b574e6fad71cdd2d8ac21c19ba0768d936 /src/print_run_watch.c | |
parent | 9aafc38370e5f2b337643d22aa04f4d34208fb03 (diff) |
able to print percentage
its now possible to have percentage before and after a variable. except
for the date. But percentage with dates does not make much sense to me, so
i skipped it.
Diffstat (limited to 'src/print_run_watch.c')
-rw-r--r-- | src/print_run_watch.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/print_run_watch.c b/src/print_run_watch.c index b108f8f..0887521 100644 --- a/src/print_run_watch.c +++ b/src/print_run_watch.c @@ -23,15 +23,17 @@ void print_run_watch(yajl_gen json_gen, char *buffer, const char *title, const c for (; *walk != '\0'; walk++) { if (*walk != '%') { *(outwalk++) = *walk; - continue; - } - if (BEGINS_WITH(walk + 1, "title")) { + } else if (BEGINS_WITH(walk + 1, "title")) { outwalk += sprintf(outwalk, "%s", title); walk += strlen("title"); + } else if (BEGINS_WITH(walk + 1, "status")) { outwalk += sprintf(outwalk, "%s", (running ? "yes" : "no")); walk += strlen("status"); + + } else { + *(outwalk++) = '%'; } } |