/*
- * Copyright (C) 1998-2013 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1998-2014 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
#include "list.h"
#include "sched.h"
#include "signal.h"
+#include "ggo.h"
#include "version.h"
/** define the array of error lists needed by para_gui */
static void add_spaces(WINDOW* win, unsigned int num)
{
char space[] = " ";
- unsigned sz = sizeof(space);
+ unsigned sz = sizeof(space) - 1; /* number of spaces */
while (num >= sz) {
waddstr(win, space);
static int loglevel;
-__printf_2_3 void curses_log(int ll, const char *fmt,...)
+static __printf_2_3 void curses_log(int ll, const char *fmt,...)
{
int color;
char *msg;
para_install_sighandler(SIGCHLD);
para_install_sighandler(SIGWINCH);
para_install_sighandler(SIGUSR1);
- para_sigaction(SIGHUP, SIG_IGN);
}
/* kill every process in the process group and exit */
{
if (loglevel > LL_NOTICE)
return;
- outputf(COLOR_WELCOME, "Welcome to para_gui " PACKAGE_VERSION
- " \"" CODENAME "\". Theme: %s", theme.name);
+ outputf(COLOR_WELCOME, "Welcome to %s. Theme: %s",
+ version_single_line("gui"), theme.name);
wclrtoeol(bot.win);
}
}
PARA_INFO_LOG("rereading command line options and config file");
gui_cmdline_parser_ext(_argc, _argv, &conf, ¶ms);
- if (gui_cmdline_parser_config_file(cf, &conf, ¶ms) != 0) {
- PARA_EMERG_LOG("errors in config file");
- finish(EXIT_FAILURE);
- }
+ gui_cmdline_parser_config_file(cf, &conf, ¶ms);
PARA_NOTICE_LOG("config file reloaded");
if (check_key_map_args() < 0)
finish(EXIT_FAILURE);
static void com_version(void)
{
- print_in_bar(COLOR_MSG, "para_gui " PACKAGE_VERSION " \""
- CODENAME "\"");
+ print_in_bar(COLOR_MSG, "%s", version_single_line("gui"));
}
__noreturn static void com_quit(void)
km_keyname(c));
}
+__noreturn static void print_help_and_die(void)
+{
+ struct ggo_help h = DEFINE_GGO_HELP(gui);
+ bool d = conf.detailed_help_given;
+
+ ggo_print_help(&h, d? GPH_STANDARD_FLAGS_DETAILED : GPH_STANDARD_FLAGS);
+ exit(0);
+}
+
int main(int argc, char *argv[])
{
int ret;
_argv = argv;
gui_cmdline_parser(argc, argv, &conf); /* exits on errors */
- HANDLE_VERSION_FLAG("gui", conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
+ version_handle_flag("gui", conf.version_given);
+ if (conf.help_given || conf.detailed_help_given)
+ print_help_and_die();
cf = configfile_exists();
if (!cf && conf.config_file_given) {
fprintf(stderr, "can not read config file %s\n",
.check_ambiguity = 0,
.print_errors = 1,
};
- if (gui_cmdline_parser_config_file(cf, &conf, ¶ms) != 0)
- exit(EXIT_FAILURE);
+ gui_cmdline_parser_config_file(cf, &conf, ¶ms);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
}
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (check_key_map_args() < 0) {
fprintf(stderr, "invalid key map\n");
exit(EXIT_FAILURE);