3 #include <yajl/yajl_gen.h>
4 #include <yajl/yajl_version.h>
8 void print_path_exists(yajl_gen json_gen, char *buffer, const char *title, const char *path, const char *format) {
10 char *outwalk = buffer;
12 const bool exists = (stat(path, &st) == 0);
16 START_COLOR((exists ? "color_good" : "color_bad"));
18 for (walk = format; *walk != '\0'; walk++) {
24 if (BEGINS_WITH(walk+1, "title")) {
25 outwalk += sprintf(outwalk, "%s", title);
26 walk += strlen("title");
27 } else if (BEGINS_WITH(walk+1, "status")) {
28 outwalk += sprintf(outwalk, "%s", (exists ? "yes" : "no"));
29 walk += strlen("status");
34 OUTPUT_FULL_TEXT(buffer);