static int signal_pipe;
-static struct win_data {
+static struct gui_window {
WINDOW *win;
size_t begx;
size_t begy;
static unsigned scroll_position;
-static int curses_active;
+static bool curses_active;
static pid_t cmd_pid;
static int command_fds[2] = {-1, -1};
if (!curses_active)
return;
def_prog_mode();
- curses_active = 0;
+ curses_active = false;
endwin();
}
/* (Re-)initialize the curses library. */
static void init_curses(void)
{
- curses_active = 1;
+ curses_active = true;
if (top.win && refresh() == ERR) /* refresh is really needed */
msg_n_exit(EXIT_FAILURE, "refresh() failed\n");
if (LINES < theme.lines_min || COLS < theme.cols_min)
for (i = 0; i < conf.key_map_given; ++i) {
s = conf.key_map_arg[i];
if (!(*s))
- goto err_out;
+ goto out;
free(tmp);
tmp = para_strdup(s);
if (!split_key_map(tmp, &handler, &arg))
- goto err_out;
+ goto out;
if (strlen(handler) != 1)
- goto err_out;
+ goto out;
if (*handler != 'x'
&& *handler != 'd'
&& *handler != 'i'
&& *handler != 'p')
- goto err_out;
+ goto out;
if (*handler != 'i')
continue;
if (find_cmd_byname(arg) < 0)
- goto err_out;
+ goto out;
}
ret = 0;
-err_out:
+out:
free(tmp);
return ret;
}
}
return;
case SIGINT:
- PARA_WARNING_LOG("caught SIGINT, reset");
+ PARA_WARNING_LOG("caught SIGINT, reset\n");
/* Nothing to do. SIGINT killed our child which gets noticed
* by do_select and resets everything.
*/
return;
case SIGUSR1:
- PARA_NOTICE_LOG("got SIGUSR1, rereading configuration");
+ PARA_NOTICE_LOG("got SIGUSR1, rereading configuration\n");
com_reread_conf();
return;
case SIGCHLD:
flags[i] = 0;
}
if (ret < 0) {
- PARA_NOTICE_LOG("closing command fd %d: %s",
+ PARA_NOTICE_LOG("closing command fd %d: %s\n",
i, para_strerror(-ret));
close(command_fds[i]);
command_fds[i] = -1;
return 0;
}
if (cbo[i] == COMMAND_BUF_SIZE - 1) {
- PARA_NOTICE_LOG("discarding overlong line");
+ PARA_NOTICE_LOG("discarding overlong line\n");
cbo[i] = 0;
flags[i] = FELF_DISCARD_FIRST;
}
if (ret < 0)
goto fail;
if (do_select(COMMAND_MODE) >= 0)
- PARA_INFO_LOG("command complete");
+ PARA_INFO_LOG("command complete\n");
else
- PARA_NOTICE_LOG("command aborted");
+ PARA_NOTICE_LOG("command aborted\n");
print_in_bar(COLOR_MSG, " ");
return;
fail:
};
if (!cf) {
- PARA_WARNING_LOG("there is no configuration to read");
+ PARA_WARNING_LOG("there is no configuration to read\n");
return;
}
- PARA_INFO_LOG("rereading command line options and config file");
+ PARA_INFO_LOG("rereading command line options and config file\n");
gui_cmdline_parser_ext(_argc, _argv, &conf, ¶ms);
/*
* Despite .print_errors is set to 0, gengetopt will print to stderr
shutdown_curses();
gui_cmdline_parser_config_file(cf, &conf, ¶ms);
init_curses();
- PARA_NOTICE_LOG("config file reloaded");
+ PARA_NOTICE_LOG("config file reloaded\n");
if (check_key_map_args() < 0)
finish(EXIT_FAILURE);
}
static void com_shrink_top_win(void)
{
if (top.lines <= theme.top_lines_min) {
- PARA_WARNING_LOG("can not decrease top window");
+ PARA_WARNING_LOG("can not decrease top window\n");
return;
}
init_wins(top.lines - 1);
static void com_enlarge_top_win(void)
{
if (bot.lines < 3) {
- PARA_WARNING_LOG("can not increase top window");
+ PARA_WARNING_LOG("can not increase top window\n");
return;
}
init_wins(top.lines + 1);
/* This seems to be needed twice, why? */
com_refresh();
com_refresh();
- PARA_NOTICE_LOG("new theme: %s", theme.name);
+ PARA_NOTICE_LOG("new theme: %s\n", theme.name);
}
static void com_next_theme(void)
exit(EXIT_FAILURE);
}
init_theme_or_die(conf.theme_arg, &theme);
- top.lines = theme.top_lines_default;
setup_signal_handling();
bot_win_rb = ringbuffer_new(RINGBUFFER_SIZE);
setlocale(LC_CTYPE, "");