/* * value's type is bool. When using this function in FP context you can't pass * a value to it, you will need to use "is_json_context()" to have different * branch for json and regular output. grep -r "print_bool" for example */ void print_color_bool(enum output_type type, enum color_attr color, const char *key, const char *fmt, bool value) { if (_IS_JSON_CONTEXT(type)) { if (key) jsonw_bool_field(_jw, key, value); else jsonw_bool(_jw, value); } else if (_IS_FP_CONTEXT(type)) { color_fprintf(stdout, color, fmt, value ? "true" : "false"); } }
void jsonw_bool_field(json_writer_t *self, const char *prop, bool val) { jsonw_name(self, prop); jsonw_bool(self, val); }