From: Jaakko Heinonen Date: Mon, 1 Aug 2005 07:59:10 +0000 (+0000) Subject: - code cleanups and minor fixes X-Git-Tag: upstream/0.6.1~2^2~188 X-Git-Url: https://git.deb.at/?p=pkg%2Fabook.git;a=commitdiff_plain;h=a4028acb18fd04cbf03ddbd976115aeb04ddd867 - code cleanups and minor fixes - call it rc3 --- diff --git a/ChangeLog b/ChangeLog index 0ecaeb4..60d654a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ - add show_cursor config option (idea from Cheryl Homiak) - autoconf/automake update - replace abook_malloc, abook_realloc and my_free with new xmalloc routines + - update for abook_rl (abook_readline) + - code cleanups and minor fixes 0.5.3 - add allcvs filters (Christoph Sobotka) diff --git a/abook.c b/abook.c index 4c9df4f..c754499 100644 --- a/abook.c +++ b/abook.c @@ -45,7 +45,7 @@ static void convert(char *srcformat, char *srcfile, static void add_email(int); char *datafile = NULL; -char *rcfile = NULL; +static char *rcfile = NULL; bool alternative_datafile = FALSE; bool alternative_rcfile = FALSE; @@ -125,7 +125,6 @@ init_abook() fgetc(stdin); } - signal(SIGKILL, quit_abook_sig); signal(SIGTERM, quit_abook_sig); if(init_ui()) @@ -692,7 +691,6 @@ static void init_add_email() { set_filenames(); - atexit(free_filenames); check_abook_directory(); init_opts(); load_opts(rcfile); diff --git a/configure b/configure index df8843c..4bfbde2 100755 --- a/configure +++ b/configure @@ -1613,7 +1613,7 @@ fi # Define the identity of the package. PACKAGE=abook - VERSION=0.5.4rc1 + VERSION=0.5.4rc3 cat >>confdefs.h <<_ACEOF @@ -6811,7 +6811,7 @@ else fi; if test x$debug = xtrue; then - CPPFLAGS="-DDEBUG $CPPFLAGS" + CPPFLAGS="-DDEBUG=1 $CPPFLAGS" CFLAGS="-g $CFLAGS" fi diff --git a/configure.in b/configure.in index 7d79dab..b2e409a 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl abook configure.in AC_INIT(abook.c) -AM_INIT_AUTOMAKE(abook, 0.5.4rc1) +AM_INIT_AUTOMAKE(abook, 0.5.4rc3) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST @@ -108,7 +108,7 @@ AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging support ], [cas esac], [debug=false]) if test x$debug = xtrue; then - CPPFLAGS="-DDEBUG $CPPFLAGS" + CPPFLAGS="-DDEBUG=1 $CPPFLAGS" CFLAGS="-g $CFLAGS" fi diff --git a/database.c b/database.c index f7bb745..e8a4fa3 100644 --- a/database.c +++ b/database.c @@ -40,7 +40,6 @@ extern int curitem; extern char *selected; extern char *datafile; -extern char *rcfile; /* * field definitions @@ -198,7 +197,7 @@ save_database() if( (out = abook_fopen(datafile, "w")) == NULL ) return -1; - if( list_is_empty() ) { + if(list_is_empty()) { fclose(out); unlink(datafile); return 1; diff --git a/list.c b/list.c index 31853a4..b208054 100644 --- a/list.c +++ b/list.c @@ -87,7 +87,7 @@ refresh_list() ui_print_number_of_items(); - if(items < 1) { + if(list_is_empty()) { refresh(); wrefresh(list); return; diff --git a/ui.c b/ui.c index 8db6b79..3098b55 100644 --- a/ui.c +++ b/ui.c @@ -45,7 +45,7 @@ extern int items, curitem; extern char *datafile; -extern int alternative_datafile; +extern bool alternative_datafile; /* * internal variables @@ -82,7 +82,7 @@ resize_abook() #ifdef TIOCGWINSZ struct winsize winsz; - ioctl (0, TIOCGWINSZ, &winsz); + ioctl(0, TIOCGWINSZ, &winsz); #ifdef DEBUG if(winsz.ws_col >= MIN_COLS && winsz.ws_row >= MIN_LINES) { fprintf(stderr, "Warning: COLS=%d, LINES=%d\n", winsz.ws_col, winsz.ws_row); @@ -265,11 +265,13 @@ statusline_ask_boolean(char *msg, int def) free(msg2); - switch( tolower(getch()) ) { + switch(tolower(getch())) { case 'n': + case 'N': ret = FALSE; break; case 'y': + case 'Y': ret = TRUE; break; default: @@ -343,7 +345,7 @@ display_help(int help) erase(); headerline("help"); - for( i = 0; tbl[i] != NULL; i++) { + for(i = 0; tbl[i] != NULL; i++) { waddstr(helpw, tbl[i]); if( ( !( (i+1) % (LINES-8) ) ) || (tbl[i+1] == NULL) ) { @@ -498,7 +500,7 @@ ui_find(int next) clear_statusline(); if(next) { - if( !*findstr ) + if(!*findstr) return; } else { char *s; @@ -548,12 +550,12 @@ ui_print_database() char *command = opt_get_str(STR_PRINT_COMMAND); int mode; - if( list_is_empty() ) + if(list_is_empty()) return; statusline_addstr("Print All/Selected/Cancel (a/s/C)?"); - switch( tolower(getch()) ) { + switch(tolower(getch())) { case 'a': mode = ENUM_ALL; break; @@ -587,13 +589,13 @@ ui_open_datafile() filename = ask_filename("File to open: "); - if( !filename || ! *filename) { + if(!filename || ! *filename) { free(filename); refresh_screen(); return; } - if( opt_get_bool(BOOL_AUTOSAVE) ) + if(opt_get_bool(BOOL_AUTOSAVE)) save_database(); else if(statusline_ask_boolean("Save current database", FALSE)) save_database(); @@ -602,7 +604,7 @@ ui_open_datafile() load_database(filename); - if( items == 0 ) { + if(items == 0) { statusline_msg("Sorry, that specified file appears not to be a valid abook addressbook"); load_database(datafile); } else { diff --git a/ui.h b/ui.h index fdb4dca..f7fd48d 100644 --- a/ui.h +++ b/ui.h @@ -33,7 +33,7 @@ void ui_print_database(); void ui_open_datafile(); -#include "options.h" /* needed for options_get_int */ +#include "options.h" /* needed for options_get_bool */ #define UI_HLINE_CHAR opt_get_bool(BOOL_USE_ASCII_ONLY) ? \ '-' : ACS_HLINE diff --git a/xmalloc.c b/xmalloc.c index e767584..d291f4d 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -36,6 +36,7 @@ #include #include #include +#include "xmalloc.h" static void xmalloc_default_error_handler(int err)