X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=ui.c;h=62b5e8f327d52340f2986c46005a47ee421c9b0a;hb=781c0d657fffe80e45d0fda6ed5ddbf5f796fefb;hp=27aa91f12f35edc1cc828c92188b1a83446d312b;hpb=392a8ae6d501ab5c20b8bb8176cac4aa9dbf99f3;p=pkg%2Fabook.git diff --git a/ui.c b/ui.c index 27aa91f..62b5e8f 100644 --- a/ui.c +++ b/ui.c @@ -22,6 +22,7 @@ #include "misc.h" #include "options.h" #include "filter.h" +#include "xmalloc.h" #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -63,7 +64,6 @@ static void init_windows() { top = newwin(LIST_TOP - 1, COLS, 0, 0); - bottom = newwin(LINES - LIST_BOTTOM, COLS, LIST_BOTTOM, 0); } @@ -112,7 +112,7 @@ resize_abook() static void win_changed(int i) { - if( can_resize ) + if(can_resize) resize_abook(); else should_resize = TRUE; @@ -155,15 +155,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 +198,7 @@ void refresh_screen() { #ifdef SIGWINCH - if( should_resize ) { + if(should_resize) { resize_abook(); return; } @@ -284,7 +284,6 @@ statusline_ask_boolean(char *msg, int def) return ret; } - void refresh_statusline() { @@ -296,7 +295,6 @@ refresh_statusline() wrefresh(bottom); } - char * ask_filename(char *prompt) { @@ -347,8 +345,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 +465,6 @@ get_commands() } } - void ui_remove_items() { @@ -609,7 +606,7 @@ ui_open_datafile() load_database(datafile); } else { free(datafile); - datafile = strdup(filename); + datafile = xstrdup(filename); } refresh_screen();