1 // vim:ts=4:sw=4:expandtab
4 #include <yajl/yajl_gen.h>
5 #include <yajl/yajl_version.h>
8 void print_run_watch(yajl_gen json_gen, char *buffer, const char *title, const char *pidfile, const char *format, const char *format_down) {
9 bool running = process_runs(pidfile);
11 char *outwalk = buffer;
13 if (running || format_down == NULL) {
21 START_COLOR((running ? "color_good" : "color_bad"));
23 for (; *walk != '\0'; walk++) {
27 } else if (BEGINS_WITH(walk + 1, "title")) {
28 outwalk += sprintf(outwalk, "%s", title);
29 walk += strlen("title");
31 } else if (BEGINS_WITH(walk + 1, "status")) {
32 outwalk += sprintf(outwalk, "%s", (running ? "yes" : "no"));
33 walk += strlen("status");
41 OUTPUT_FULL_TEXT(buffer);