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