X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=ui.c;h=40dc1e138f5a1344e67764df48676fce631e37f5;hb=ce5cddb064b82a0103d1e02f5749d8614dcdb6c6;hp=3098b553435a4dd7ab1e14001b763a152080d1fb;hpb=a4028acb18fd04cbf03ddbd976115aeb04ddd867;p=pkg%2Fabook.git diff --git a/ui.c b/ui.c index 3098b55..40dc1e1 100644 --- a/ui.c +++ b/ui.c @@ -22,16 +22,10 @@ #include "misc.h" #include "options.h" #include "filter.h" +#include "xmalloc.h" #ifdef HAVE_CONFIG_H # include "config.h" #endif -#ifdef HAVE_TERMIOS_H -# include -#else -# ifdef HAVE_LINUX_TERMIOS_H -# include -# endif -#endif #ifdef HAVE_SYS_IOCTL_H # include #endif @@ -51,19 +45,18 @@ extern bool alternative_datafile; * internal variables */ -bool ui_initialized = FALSE; +static bool ui_initialized = FALSE; -bool should_resize = FALSE; -bool can_resize = FALSE; +static bool should_resize = FALSE; +static bool can_resize = FALSE; -WINDOW *top = NULL, *bottom = NULL; +static WINDOW *top = NULL, *bottom = NULL; static void init_windows() { top = newwin(LIST_TOP - 1, COLS, 0, 0); - bottom = newwin(LINES - LIST_BOTTOM, COLS, LIST_BOTTOM, 0); } @@ -112,7 +105,7 @@ resize_abook() static void win_changed(int i) { - if( can_resize ) + if(can_resize) resize_abook(); else should_resize = TRUE; @@ -155,15 +148,15 @@ init_ui() return 1; } -#ifdef SIGWINCH - signal(SIGWINCH, win_changed); -#endif - init_list(); init_windows(); ui_initialized = TRUE; +#ifdef SIGWINCH + signal(SIGWINCH, win_changed); +#endif + return 0; } @@ -198,7 +191,7 @@ void refresh_screen() { #ifdef SIGWINCH - if( should_resize ) { + if(should_resize) { resize_abook(); return; } @@ -284,7 +277,6 @@ statusline_ask_boolean(char *msg, int def) return ret; } - void refresh_statusline() { @@ -296,7 +288,6 @@ refresh_statusline() wrefresh(bottom); } - char * ask_filename(char *prompt) { @@ -347,8 +338,8 @@ display_help(int help) for(i = 0; tbl[i] != NULL; i++) { waddstr(helpw, tbl[i]); - if( ( !( (i+1) % (LINES-8) ) ) || - (tbl[i+1] == NULL) ) { + if( (!((i + 1) % (LINES - 8))) || + (tbl[i + 1] == NULL) ) { refresh(); wrefresh(helpw); refresh_statusline(); @@ -467,7 +458,6 @@ get_commands() } } - void ui_remove_items() { @@ -609,7 +599,7 @@ ui_open_datafile() load_database(datafile); } else { free(datafile); - datafile = strdup(filename); + datafile = xstrdup(filename); } refresh_screen();