/*
- * Copyright (C) 1998-2010 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1998-2011 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
str[len] = '\0';
num = 0;
}
- /* replace newlines by spaces */
+ /* replace control characters by spaces */
for (i = 0; i < len && str[i]; i++) {
- if (str[i] == '\n')
+ if (str[i] == '\n' || str[i] == '\r' || str[i] == '\f')
str[i] = ' ';
}
if (align == LEFT) {
if (init)
init = 0;
else
- sleep(1);
+ /*
+ * Sleep a bit to avoid a busy loop. As the call to sleep() may
+ * be interrupted by SIGCHLD, we simply wait until the call
+ * succeeds.
+ */
+ while (sleep(2))
+ ; /* nothing */
ret = para_exec_cmdline_pid(&pid, conf.stat_cmd_arg, fds);
if (ret < 0)
return ret;
_argc = argc;
_argv = argv;
- if (gui_cmdline_parser(argc, argv, &conf)) {
- fprintf(stderr, "parse error while reading command line\n");
- exit(EXIT_FAILURE);
- }
+ gui_cmdline_parser(argc, argv, &conf);
HANDLE_VERSION_FLAG("gui", conf);
- init_theme(0, &theme);
- top.lines = theme.top_lines_default;
if (check_key_map_args() < 0) {
fprintf(stderr, "invalid key map\n");
exit(EXIT_FAILURE);
fprintf(stderr, "invalid key map in config file\n");
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);
initscr(); /* needed only once, always successful */