X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fprint_run_watch.c;h=f0a0746b0984d46dfef18267b151b95d2a18c277;hb=0e4fd9ad4a4cc7d6c770134a077e91b02f6cd2f0;hp=b108f8fef85b728ac2d388b6055744c6c13bd400;hpb=5c094a54932edebf6e44c4a7119fa510ddf7ae7a;p=i3%2Fi3status diff --git a/src/print_run_watch.c b/src/print_run_watch.c index b108f8f..f0a0746 100644 --- a/src/print_run_watch.c +++ b/src/print_run_watch.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include @@ -23,15 +24,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++) = '%'; } }