-static int current_nesting_level;
-static bool parse_error_key;
-static bool command_failed;
-
-pid_t command_error_nagbar_pid = -1;
-
-static int json_boolean(void *ctx, int boolval) {
- DLOG("Got bool: %d, parse_error_key %d, nesting_level %d\n", boolval, parse_error_key, current_nesting_level);
-
- if (parse_error_key && current_nesting_level == 1 && boolval)
- command_failed = true;
-
- return 1;
-}
-
-#if YAJL_MAJOR >= 2
-static int json_map_key(void *ctx, const unsigned char *stringval, size_t stringlen) {
-#else
-static int json_map_key(void *ctx, const unsigned char *stringval, unsigned int stringlen) {
-#endif
- parse_error_key = (stringlen >= strlen("parse_error") &&
- strncmp((const char*)stringval, "parse_error", strlen("parse_error")) == 0);
- return 1;
-}
-
-static int json_start_map(void *ctx) {
- current_nesting_level++;
- return 1;
-}
-
-static int json_end_map(void *ctx) {
- current_nesting_level--;
- return 1;
-}
-
-static yajl_callbacks command_error_callbacks = {
- .yajl_boolean = json_boolean,
- .yajl_start_map = json_start_map,
- .yajl_map_key = json_map_key,
- .yajl_end_map = json_end_map,
-};
-