ev_child *child_sig;
/* JSON parser for stdin */
-yajl_callbacks callbacks;
yajl_handle parser;
/* JSON generator for stdout */
/*
* Helper function to read stdin
*
+ * Returns NULL on EOF.
+ *
*/
static unsigned char *get_buffer(ev_io *watcher, int *ret_buffer_len) {
int fd = watcher->fd;
exit(EXIT_FAILURE);
}
if (n == 0) {
- /* end of file, kill the watcher */
ELOG("stdin: received EOF\n");
- cleanup();
- set_statusline_error("Received EOF from statusline process");
- draw_bars(false);
*ret_buffer_len = -1;
return NULL;
}
if (exit_status == 126)
set_statusline_error("status_command is not executable (exit %d)", exit_status);
else if (exit_status == 127)
- set_statusline_error("status_command not found (exit %d)", exit_status);
+ set_statusline_error("status_command not found or is missing a library dependency (exit %d)", exit_status);
else
set_statusline_error("status_command process exited unexpectedly (exit %d)", exit_status);
return;
/* Allocate a yajl parser which will be used to parse stdin. */
- memset(&callbacks, '\0', sizeof(yajl_callbacks));
- callbacks.yajl_map_key = stdin_map_key;
- callbacks.yajl_boolean = stdin_boolean;
- callbacks.yajl_string = stdin_string;
- callbacks.yajl_integer = stdin_integer;
- callbacks.yajl_start_array = stdin_start_array;
- callbacks.yajl_end_array = stdin_end_array;
- callbacks.yajl_start_map = stdin_start_map;
- callbacks.yajl_end_map = stdin_end_map;
+ static yajl_callbacks callbacks = {
+ .yajl_boolean = stdin_boolean,
+ .yajl_integer = stdin_integer,
+ .yajl_string = stdin_string,
+ .yajl_start_map = stdin_start_map,
+ .yajl_map_key = stdin_map_key,
+ .yajl_end_map = stdin_end_map,
+ .yajl_start_array = stdin_start_array,
+ .yajl_end_array = stdin_end_array,
+ };
#if YAJL_MAJOR < 2
yajl_parser_config parse_conf = { 0, 0 };