]> git.deb.at Git - pkg/abook.git/blobdiff - ui.c
- don't try to use linux/termios.h
[pkg/abook.git] / ui.c
diff --git a/ui.c b/ui.c
index 27aa91f12f35edc1cc828c92188b1a83446d312b..4f162e179149d68595a518c823e7e2e43de244f1 100644 (file)
--- a/ui.c
+++ b/ui.c
 #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 <termios.h>
-#else
-#      ifdef HAVE_LINUX_TERMIOS_H
-#              include <linux/termios.h>
-#      endif
 #endif
 #ifdef HAVE_SYS_IOCTL_H
 #      include <sys/ioctl.h>
@@ -63,7 +60,6 @@ static void
 init_windows()
 {
        top = newwin(LIST_TOP - 1, COLS, 0, 0);
-
        bottom = newwin(LINES - LIST_BOTTOM, COLS, LIST_BOTTOM, 0);
 }
 
@@ -112,7 +108,7 @@ resize_abook()
 static void
 win_changed(int i)
 {
-       if( can_resize )
+       if(can_resize)
                resize_abook();
        else
                should_resize = TRUE;
@@ -155,15 +151,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 +194,7 @@ void
 refresh_screen()
 {
 #ifdef SIGWINCH
-       if( should_resize ) {
+       if(should_resize) {
                resize_abook();
                return;
        }
@@ -284,7 +280,6 @@ statusline_ask_boolean(char *msg, int def)
        return ret;
 }
 
-
 void
 refresh_statusline()
 {
@@ -296,7 +291,6 @@ refresh_statusline()
        wrefresh(bottom);
 }
 
-
 char *
 ask_filename(char *prompt)
 {
@@ -347,8 +341,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 +461,6 @@ get_commands()
        }
 }
 
-
 void
 ui_remove_items()
 {
@@ -609,7 +602,7 @@ ui_open_datafile()
                load_database(datafile);
        } else {
                free(datafile);
-               datafile = strdup(filename);
+               datafile = xstrdup(filename);
        }
 
        refresh_screen();