From: Jaakko Heinonen Date: Mon, 23 Apr 2001 15:04:58 +0000 (+0000) Subject: Merged first 0.4.13pre patch X-Git-Tag: upstream/0.6.1~2^2~387 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=3212da92838c056bcc1cafa57beaf26086e2ac96;p=pkg%2Fabook.git Merged first 0.4.13pre patch --- diff --git a/ChangeLog b/ChangeLog index f94c8d6..f88948b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +0.4.13 + - major code reorganization (phase 1) + - fixed help viewer functions + - ability to disable use of non-ascii characters (configuration option) + 0.4.12 - added man page for abookrc (Alan Ford) - notes are returned as optional data in mutt queries diff --git a/Makefile.am b/Makefile.am index 5bc5d55..a46c2a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,9 @@ bin_PROGRAMS = abook abook_SOURCES = abook.c database.c filter.c list.c misc.c conff.c \ - options.c edit.c ldif.c estr.c \ + options.c edit.c ldif.c estr.c ui.c \ abook.h database.h filter.h list.h misc.h help.h conff.h \ - options.h edit.h ldif.h estr.h abook_curses.h + options.h edit.h ldif.h estr.h abook_curses.h ui.h EXTRA_DIST = ANNOUNCE BUGS FAQ abook.1 abookrc.5 sample.abookrc diff --git a/Makefile.in b/Makefile.in index b9ffdc5..e016284 100644 --- a/Makefile.in +++ b/Makefile.in @@ -68,7 +68,7 @@ VERSION = @VERSION@ bin_PROGRAMS = abook -abook_SOURCES = abook.c database.c filter.c list.c misc.c conff.c options.c edit.c ldif.c estr.c abook.h database.h filter.h list.h misc.h help.h conff.h options.h edit.h ldif.h estr.h abook_curses.h +abook_SOURCES = abook.c database.c filter.c list.c misc.c conff.c options.c edit.c ldif.c estr.c ui.c abook.h database.h filter.h list.h misc.h help.h conff.h options.h edit.h ldif.h estr.h abook_curses.h ui.h EXTRA_DIST = ANNOUNCE BUGS FAQ abook.1 abookrc.5 sample.abookrc @@ -84,7 +84,7 @@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ abook_OBJECTS = abook.o database.o filter.o list.o misc.o conff.o \ -options.o edit.o ldif.o estr.o +options.o edit.o ldif.o estr.o ui.o abook_LDADD = $(LDADD) abook_DEPENDENCIES = abook_LDFLAGS = diff --git a/abook.c b/abook.c index dadf41e..5277123 100644 --- a/abook.c +++ b/abook.c @@ -3,7 +3,7 @@ * * by JH * - * Copyright (C) 1999, 2000 Jaakko Heinonen + * Copyright (C) Jaakko Heinonen */ #include @@ -12,108 +12,49 @@ #include #include #include -#include "abook_curses.h" #ifdef HAVE_CONFIG_H # include "config.h" #endif #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) # include #endif -#ifdef HAVE_TERMIOS_H -# include -#else -# ifdef HAVE_LINUX_TERMIOS_H -# include -# endif -#endif -#ifdef HAVE_SYS_IOCTL_H -# include -#endif #include "abook.h" +#include "ui.h" #include "database.h" #include "list.h" #include "filter.h" #include "edit.h" #include "misc.h" -#include "help.h" #include "options.h" -#include "estr.h" static void init_abook(); static void set_filenames(); static void free_filenames(); -static void display_help(char **tbl); -static void get_commands(); static void parse_command_line(int argc, char **argv); static void show_usage(); static void mutt_query(char *str); static void init_mutt_query(); static void quit_mutt_query(); -static void launch_mutt(); -static void launch_lynx(); -static void win_changed(int dummy); -static void open_datafile(); -#ifdef SIGWINCH -static void resize_abook(); -#endif static void convert(char *srcformat, char *srcfile, char *dstformat, char *dstfile); -int should_resize = FALSE; -int can_resize = FALSE; - char *datafile = NULL; char *rcfile = NULL; -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); -} - -static void -free_windows() -{ - delwin(top); - delwin(bottom); -} - static void init_abook() { set_filenames(); init_options(); - initscr(); cbreak(); noecho(); - nonl(); - intrflush(stdscr, FALSE); - keypad(stdscr, TRUE); -#ifdef DEBUG - fprintf(stderr, "init_abook():\n"); - fprintf(stderr, " COLS = %d, LINES = %d\n", COLS, LINES); -#endif - if( LINES < MIN_LINES || COLS < MIN_COLS ) { - clear(); refresh(); endwin(); - fprintf(stderr, "Your terminal size is %dx%d\n", COLS, LINES); - fprintf(stderr, "Terminal is too small. Minium terminal size " - "for abook is " - "%dx%d\n", MIN_COLS, MIN_LINES); - exit(1); - } - umask(DEFAULT_UMASK); -#ifdef SIGWINCH - signal(SIGWINCH, win_changed); -#endif signal(SIGINT, quit_abook); signal(SIGKILL, quit_abook); signal(SIGTERM, quit_abook); - init_list(); - init_windows(); + if( init_ui() ) + exit(1); + + umask(DEFAULT_UMASK); /* * this is very ugly for now @@ -155,12 +96,9 @@ quit_abook() } close_config(); close_database(); - close_list(); - free_windows(); - clear(); - refresh(); - endwin(); + close_ui(); + exit(0); } @@ -207,299 +145,6 @@ free_filenames() my_free(datafile); } -void -headerline(char *str) -{ - werase(top); - - mvwhline(top, 1, 0, ACS_HLINE, COLS); - - mvwprintw(top, 0, 0, "%s | %s", PACKAGE " " VERSION, str); - - refresh(); - wrefresh(top); -} - - -void -refresh_screen() -{ -#ifdef SIGWINCH - if( should_resize ) { - resize_abook(); - return; - } -#endif - clear(); - - refresh_statusline(); - headerline(MAIN_HELPLINE); - list_headerline(); - - refresh_list(); -} - -#ifdef DEBUG -extern int curitem; -extern list_item *database; -static void -dump_item() -{ - int i; - - fprintf(stderr,"sizeof(list_item) = %d\n", sizeof(list_item)); - fprintf(stderr,"--- dumping item %d ---\n", curitem); - - for(i=0; i= 0) { - selected[curitem] = !selected[curitem]; - print_number_of_items(); - refresh_list(); - } - break; - case '+': select_all(); - refresh_list(); - break; - case '-': select_none(); - refresh_list(); - break; - case '*': invert_selection(); - refresh_list(); - break; - case 'A': move_curitem(MOVE_ITEM_UP); - break; - case 'Z': move_curitem(MOVE_ITEM_DOWN); - break; - - case 'm': launch_mutt(); break; - - case 'p': print_database(); break; - - case 'u': launch_lynx(); break; -#ifdef DEBUG - case 'D': dump_item(); -#endif - } - } -} - - -static void -display_help(char **tbl) -{ - int i, j = 3; - - erase(); - headerline("help"); - refresh_statusline(); - - for( i = 0; tbl[i] != NULL; i++) { - mvaddstr(j++, 0, tbl[i]); - if( ( !( (i+1) % (LINES-7) ) ) || - (tbl[i+1] == NULL) ) { - refresh(); - statusline_msg("Press any key to continue..."); - erase(); - refresh_statusline(); - headerline("help"); - j = 3; - } - } - refresh_screen(); -} - -void -display_editor_help(WINDOW *w) -{ - int i; - - werase(w); - - headerline("editor help"); - - for( i = 0; editorhelp[i] != NULL; i++) { - waddstr(w, editorhelp[i]); - if( ( !( (i+1) % (LINES-8) ) ) || - (editorhelp[i+1] == NULL) ) { - refresh(); - wrefresh(w); - statusline_msg("Press any key to continue..."); - wclear(w); - } - } -} - - -void -statusline_msg(char *msg) -{ - clear_statusline(); - statusline_addstr(msg); - getch(); -#ifdef DEBUG - fprintf(stderr, "statusline_msg(\"%s\")\n", msg); -#endif - clear_statusline(); -} - -void -statusline_addstr(char *str) -{ - mvwaddstr(bottom, 1, 0, str); - refresh(); - wrefresh(bottom); -} - -/* - * function statusline_getnstr - * - * parameters: - * (char *str) - * if n >= 0 str is a pointer which points a place where to store - * the string, else str is ingnored - * (int n) - * the maximum length of the string - * If n < 0 function will allocate needed space for the string. - * Value 0 is not allowed for n. - * (int use_filesel) - * if this value is nonzero the fileselector is enabled - * - * returns (char *) - * If n < 0 a pointer to a newly allocated string is returned. - * If n > 0 a nonzero value is returned if user has typed a valid - * string. If not NULL value is returned. Never really use the - * _pointer_ if n > 0. - * - */ - -char * -statusline_getnstr(char *str, int n, int use_filesel) -{ - char *buf; - int y, x; - - getyx(bottom, y, x); - wmove(bottom, 1, x); - - buf = wenter_string(bottom, n, - (use_filesel ? ESTR_USE_FILESEL:0) | ESTR_DONT_WRAP); - - if(n < 0) - return buf; - - if(buf == NULL) - str[0] = 0; - else - strncpy(str, buf, n); - - str[n-1] = 0; - - free(buf); - - return buf; -} - -void -refresh_statusline() -{ - werase(bottom); - - mvwhline(bottom, 0, 0, ACS_HLINE, COLS); - mvwhline(bottom, 2, 0, ACS_HLINE, COLS); - - refresh(); - wrefresh(bottom); -} - - -char * -ask_filename(char *prompt, int flags) -{ - char *buf = NULL; - - clear_statusline(); - - statusline_addstr(prompt); - buf = statusline_getnstr(NULL, -1, flags); - - clear_statusline(); - - return buf; -} - -void -clear_statusline() -{ - wmove(bottom, 1, 0); - wclrtoeol(bottom); - wrefresh(bottom); - refresh(); -} - static void parse_command_line(int argc, char **argv) { @@ -681,7 +326,7 @@ quit_mutt_query(int status) } -static void +void launch_mutt() { int i; @@ -689,13 +334,13 @@ launch_mutt() char *cmd; char *tmp = options_get_str("mutt_command"); - if(curitem < 0) + if( list_is_empty() ) return; cmd = strconcat(tmp, " '", NULL ); for(i=0; i < items; i++) { - if( ! selected[i] && i != curitem ) + if( ! is_selected(i) && i != list_current_item() ) continue; get_first_email(email, i); tmp = mkstr("%s \"%s\"", cmd, database[i][NAME]); @@ -721,18 +366,18 @@ launch_mutt() refresh_screen(); } -static void +void launch_lynx() { char *cmd = NULL; - if(curitem < 0) + if( list_is_empty() ) return; - if( database[curitem][URL] ) + if( database[list_current_item()][URL] ) cmd = mkstr("%s '%s'", options_get_str("www_command"), - safe_str(database[curitem][URL])); + safe_str(database[list_current_item()][URL])); else return; @@ -749,7 +394,7 @@ abook_malloc(size_t size) void *ptr; if ( (ptr = malloc(size)) == NULL ) { - if(top) /* determinate if init_abook has been called */ + if( is_ui_initialized() ) quit_abook(); perror("malloc() failed"); exit(1); @@ -767,7 +412,7 @@ abook_realloc(void *ptr, size_t size) return NULL; if( ptr == NULL ) { - if(top) /* determinate if init_abook has been called */ + if( is_ui_initialized() ) quit_abook(); perror("realloc() failed"); exit(1); @@ -791,49 +436,6 @@ abook_fopen (const char *path, const char *mode) } -static void -win_changed(int i) -{ - if( can_resize ) - resize_abook(); - else - should_resize = TRUE; -} - -#ifdef SIGWINCH -static void -resize_abook() -{ -#ifdef TIOCGWINSZ - struct winsize 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); - } -#endif - - if(winsz.ws_col >= MIN_COLS && winsz.ws_row >= MIN_LINES) { -#ifdef HAVE_RESIZETERM - resizeterm(winsz.ws_row, winsz.ws_col); -#else - COLS = winsz.ws_col; - LINES = winsz.ws_row; -#endif - } - - should_resize = FALSE; - close_list(); /* we need to recreate windows */ - init_list(); - free_windows(); - init_windows(); - refresh_screen(); - refresh(); -#endif /* TIOCGWINSZ */ -} -#endif /* SIGWINCH */ - static void convert(char *srcformat, char *srcfile, char *dstformat, char *dstfile) @@ -885,42 +487,3 @@ convert(char *srcformat, char *srcfile, char *dstformat, char *dstfile) } -static void -open_datafile() -{ - char *filename; - - filename = ask_filename("File to open: ", 1); - - if( !filename ) { - refresh_screen(); - return; - } - - if( options_get_int("autosave") ) - save_database(); - else { - statusline_addstr("Save current database (y/N)"); - switch( getch() ) { - case 'y': - case 'Y': - save_database(); - default: break; - } - } - - close_database(); - - load_database(filename); - - if( items == 0 ) { - statusline_msg("Sorry, that specified file appears not to be a valid abook addressbook"); - load_database(datafile); - } else { - free(datafile); - datafile = strdup(filename); - } - - refresh_screen(); - free(filename); -} diff --git a/abook.h b/abook.h index 64ea077..e09145f 100644 --- a/abook.h +++ b/abook.h @@ -1,19 +1,14 @@ #ifndef _ABOOK_H #define _ABOOK_H -void refresh_screen(); -void statusline_msg(char *msg); -char *ask_filename(char *prompt, int flags); -void clear_statusline(); -void statusline_addstr(char *str); -char *statusline_getnstr(char *str, int n, int use_filesel); -void headerline(char *str); -void refresh_statusline(); -void display_editor_help(); +#include + void *abook_malloc(size_t size); void *abook_realloc(void *ptr, size_t size); FILE *abook_fopen (const char *path, const char *mode); void quit_abook(); +void launch_lynx(); +void launch_mutt(); #ifdef _AIX int strcasecmp (const char *, const char *); int strncasecmp (const char *, const char *, size_t); diff --git a/acconfig.h b/acconfig.h index 3e221f5..90e78f1 100644 --- a/acconfig.h +++ b/acconfig.h @@ -10,3 +10,4 @@ #undef HAVE_SNPRINTF #undef HAVE_VSNPRINTF +#undef USE_ASCII_ONLY diff --git a/config.h.in b/config.h.in index 2e29e1b..5cba7f7 100644 --- a/config.h.in +++ b/config.h.in @@ -15,6 +15,8 @@ #undef HAVE_SNPRINTF #undef HAVE_VSNPRINTF +#undef USE_ASCII_ONLY + /* Define if you have the resizeterm function. */ #undef HAVE_RESIZETERM diff --git a/configure b/configure index 2fe5ac9..76f3a1c 100755 --- a/configure +++ b/configure @@ -14,7 +14,9 @@ ac_default_prefix=/usr/local ac_help="$ac_help --with-curses=DIR Where ncurses is installed " ac_help="$ac_help - --enable-debug Enable debugging support " + --enable-debug Enable debugging support " +ac_help="$ac_help + --disable-nonascii Disable usage of non-ascii characters " # Initialize some variables set by options. # The variables have the same names as the options, with @@ -556,7 +558,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:560: checking for a BSD compatible install" >&5 +echo "configure:562: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -609,7 +611,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:613: checking whether build environment is sane" >&5 +echo "configure:615: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -666,7 +668,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:670: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -695,7 +697,7 @@ fi PACKAGE=abook -VERSION=0.4.13-cvs +VERSION=0.4.13-dev if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -712,7 +714,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:716: checking for working aclocal" >&5 +echo "configure:718: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -725,7 +727,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:729: checking for working autoconf" >&5 +echo "configure:731: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -738,7 +740,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:742: checking for working automake" >&5 +echo "configure:744: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -751,7 +753,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:755: checking for working autoheader" >&5 +echo "configure:757: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -764,7 +766,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:768: checking for working makeinfo" >&5 +echo "configure:770: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -788,7 +790,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:792: checking host system type" >&5 +echo "configure:794: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -812,7 +814,7 @@ echo "$ac_t""$host" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:816: checking for $ac_word" >&5 +echo "configure:818: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -842,7 +844,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:846: checking for $ac_word" >&5 +echo "configure:848: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -893,7 +895,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:897: checking for $ac_word" >&5 +echo "configure:899: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -925,7 +927,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:929: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:931: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -936,12 +938,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 940 "configure" +#line 942 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -967,12 +969,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:971: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:973: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:976: checking whether we are using GNU C" >&5 +echo "configure:978: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -981,7 +983,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1000,7 +1002,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1004: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1006: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1032,7 +1034,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1036: checking for POSIXized ISC" >&5 +echo "configure:1038: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -1056,7 +1058,7 @@ fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:1060: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:1062: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1072,7 +1074,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__ do CC="$ac_save_CC $ac_arg" cat > conftest.$ac_ext < #include @@ -1109,7 +1111,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } EOF -if { (eval echo configure:1113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_prog_cc_stdc="$ac_arg"; break else @@ -1133,7 +1135,7 @@ case "x$am_cv_prog_cc_stdc" in esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1137: checking how to run the C preprocessor" >&5 +echo "configure:1139: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1148,13 +1150,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1165,13 +1167,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1175: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1182,13 +1184,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1215,7 +1217,7 @@ echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for function prototypes""... $ac_c" 1>&6 -echo "configure:1219: checking for function prototypes" >&5 +echo "configure:1221: checking for function prototypes" >&5 if test "$am_cv_prog_cc_stdc" != no; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -1228,12 +1230,12 @@ else U=_ ANSI2KNR=./ansi2knr # Ensure some checks needed by ansi2knr itself. echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1232: checking for ANSI C header files" >&5 +echo "configure:1234: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1241,7 +1243,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1258,7 +1260,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1276,7 +1278,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1297,7 +1299,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1308,7 +1310,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1335,17 +1337,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1339: checking for $ac_hdr" >&5 +echo "configure:1341: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1377,21 +1379,21 @@ if test "x$U" != "x"; then { echo "configure: error: Compiler not ANSI compliant" 1>&2; exit 1; } fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1381: checking for inline" >&5 +echo "configure:1383: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1428,7 +1430,7 @@ esac # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1432: checking for a BSD compatible install" >&5 +echo "configure:1434: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1481,12 +1483,12 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1485: checking for ANSI C header files" >&5 +echo "configure:1487: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1494,7 +1496,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1511,7 +1513,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1529,7 +1531,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1550,7 +1552,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1561,7 +1563,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1588,17 +1590,17 @@ for ac_hdr in unistd.h locale.h termios.h linux/termios.h sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1592: checking for $ac_hdr" >&5 +echo "configure:1594: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1626,17 +1628,17 @@ done ac_safe=`echo "stdarg.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for stdarg.h""... $ac_c" 1>&6 -echo "configure:1630: checking for stdarg.h" >&5 +echo "configure:1632: checking for stdarg.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1664,12 +1666,12 @@ fi for ac_func in setlocale do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1668: checking for $ac_func" >&5 +echo "configure:1670: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1733,7 +1735,7 @@ fi echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6 -echo "configure:1737: checking for initscr in -lncurses" >&5 +echo "configure:1739: checking for initscr in -lncurses" >&5 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1741,7 +1743,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1775,17 +1777,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1779: checking for $ac_hdr" >&5 +echo "configure:1781: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1815,12 +1817,12 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for initscr""... $ac_c" 1>&6 -echo "configure:1819: checking for initscr" >&5 +echo "configure:1821: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else @@ -1864,7 +1866,7 @@ else case $host_os in #(vi freebsd*) #(vi echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 -echo "configure:1868: checking for tgoto in -lmytinfo" >&5 +echo "configure:1870: checking for tgoto in -lmytinfo" >&5 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1872,7 +1874,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmytinfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1906,7 +1908,7 @@ fi ;; hpux10.*|hpux11.*) echo $ac_n "checking for initscr in -lcur_colr""... $ac_c" 1>&6 -echo "configure:1910: checking for initscr in -lcur_colr" >&5 +echo "configure:1912: checking for initscr in -lcur_colr" >&5 ac_lib_var=`echo cur_colr'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1914,7 +1916,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcur_colr $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1949,7 +1951,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6 -echo "configure:1953: checking for initscr in -lHcurses" >&5 +echo "configure:1955: checking for initscr in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1957,7 +1959,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2017,12 +2019,12 @@ if test ".$ac_cv_func_initscr" != .yes ; then # Check for library containing tgoto. Do this before curses library # because it may be needed to link the test-case for initscr. echo $ac_n "checking for tgoto""... $ac_c" 1>&6 -echo "configure:2021: checking for tgoto" >&5 +echo "configure:2023: checking for tgoto" >&5 if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_tgoto=yes" else @@ -2066,7 +2068,7 @@ else for cf_term_lib in termcap termlib unknown do echo $ac_n "checking for tgoto in -l$cf_term_lib""... $ac_c" 1>&6 -echo "configure:2070: checking for tgoto in -l$cf_term_lib" >&5 +echo "configure:2072: checking for tgoto in -l$cf_term_lib" >&5 ac_lib_var=`echo $cf_term_lib'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2074,7 +2076,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$cf_term_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2115,7 +2117,7 @@ fi for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown do echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6 -echo "configure:2119: checking for initscr in -l$cf_curs_lib" >&5 +echo "configure:2121: checking for initscr in -l$cf_curs_lib" >&5 ac_lib_var=`echo $cf_curs_lib'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2123,7 +2125,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$cf_curs_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2160,16 +2162,16 @@ fi LIBS="-l$cf_curs_lib $cf_save_LIBS" if test "$cf_term_lib" = unknown ; then echo $ac_n "checking if we can link with $cf_curs_lib library""... $ac_c" 1>&6 -echo "configure:2164: checking if we can link with $cf_curs_lib library" >&5 +echo "configure:2166: checking if we can link with $cf_curs_lib library" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF -if { (eval echo configure:2173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else @@ -2183,16 +2185,16 @@ rm -f conftest* test $cf_result = no && { echo "configure: error: Cannot link curses library" 1>&2; exit 1; } elif test "$cf_term_lib" != predefined ; then echo $ac_n "checking if we need both $cf_curs_lib and $cf_term_lib libraries""... $ac_c" 1>&6 -echo "configure:2187: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 +echo "configure:2189: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 cat > conftest.$ac_ext < int main() { initscr(); tgoto((char *)0, 0, 0); ; return 0; } EOF -if { (eval echo configure:2196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=no else @@ -2202,14 +2204,14 @@ else LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF -if { (eval echo configure:2213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else @@ -2236,12 +2238,12 @@ fi for ac_func in resizeterm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2240: checking for $ac_func" >&5 +echo "configure:2242: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2270: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2290,12 +2292,12 @@ done echo $ac_n "checking for snprintf""... $ac_c" 1>&6 -echo "configure:2294: checking for snprintf" >&5 +echo "configure:2296: checking for snprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_snprintf=yes" else @@ -2341,12 +2343,12 @@ else fi echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 -echo "configure:2345: checking for vsnprintf" >&5 +echo "configure:2347: checking for vsnprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vsnprintf=yes" else @@ -2410,6 +2412,30 @@ if test x$debug = xtrue; then CFLAGS="-g $CFLAGS" fi +# Check whether --enable-nonascii or --disable-nonascii was given. +if test "${enable_nonascii+set}" = set; then + enableval="$enable_nonascii" + case "${enableval}" in + yes) nonascii=true ;; + no) nonascii=false ;; + *) { echo "configure: error: bad value ${enableval} for --disable-nonascii" 1>&2; exit 1; } ;; + esac +else + nonascii=true +fi + + +if test x$nonascii = xfalse; then + cat >> confdefs.h <<\EOF +#define USE_ASCII_ONLY 1 +EOF + +fi + +if test x$debug = xtrue; then + CPPFLAGS="-DDEBUG $CPPFLAGS" + CFLAGS="-g $CFLAGS" +fi if test x$GCC = xyes; then CFLAGS="-Wall $CFLAGS" fi diff --git a/configure.in b/configure.in index afc2379..41a132d 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl abook configure.in AC_INIT(abook.c) -AM_INIT_AUTOMAKE(abook, 0.4.13-cvs) +AM_INIT_AUTOMAKE(abook, 0.4.13-dev) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST @@ -50,7 +50,7 @@ AC_CHECK_FUNCS(resizeterm) AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)],) AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)],) -AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging support ], [case "${enableval}" in +AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging support ], [case "${enableval}" in yes) debug=true ;; no) debug=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; @@ -61,6 +61,20 @@ if test x$debug = xtrue; then CFLAGS="-g $CFLAGS" fi +AC_ARG_ENABLE(nonascii, [ --disable-nonascii Disable usage of non-ascii characters ], [case "${enableval}" in + yes) nonascii=true ;; + no) nonascii=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-nonascii) ;; + esac], [nonascii=true]) + +if test x$nonascii = xfalse; then + AC_DEFINE(USE_ASCII_ONLY) +fi + +if test x$debug = xtrue; then + CPPFLAGS="-DDEBUG $CPPFLAGS" + CFLAGS="-g $CFLAGS" +fi if test x$GCC = xyes; then CFLAGS="-Wall $CFLAGS" fi diff --git a/database.c b/database.c index cf02d57..a2c396d 100644 --- a/database.c +++ b/database.c @@ -12,7 +12,6 @@ #include #include #include -#include "abook_curses.h" #include "abook.h" #include "database.h" #include "list.h" @@ -277,23 +276,13 @@ add_item2database(list_item item) } void -remove_items() +remove_selected_items() { int i, j; if( items < 1 || curitem < 0 ) return; - statusline_addstr("Remove selected item(s) (Y/n)"); - switch( getch() ) { - case '\r': - case 'y': - case 'Y': break; - default: - clear_statusline(); - return; - } - if( ! selected_items() ) selected[ curitem ] = 1; @@ -315,8 +304,6 @@ remove_items() adjust_list_capacity(); select_none(); - clear_statusline(); - refresh_list(); } char * @@ -392,110 +379,38 @@ sort_surname() refresh_screen(); } -void -clear_database() -{ - - statusline_addstr("Clear WHOLE database (y/N)"); - switch( getch() ) { - case 'y': - case 'Y': break; - default: - clear_statusline(); - return; - } - - close_database(); - - refresh_screen(); -} - -void -find(int next) +int +find_item(char *str, int start) { int i; - static char findstr[MAX_FIELD_LEN]; - char tmp[MAX_FIELD_LEN]; + char *findstr = NULL; + char *tmp = NULL; + int ret = -1; /* not found */ -#ifdef DEBUG - fprintf(stderr, "find(): findstr = |%s|\n", findstr); -#endif - - if(next) { - if( !*findstr ) - return; - } else { - clear_statusline(); - statusline_addstr("/"); - statusline_getnstr(findstr, MAX_FIELD_LEN - 1, 0); - strupper(findstr); - clear_statusline(); - } + if(items < 1 || start < 0 || start >= LAST_ITEM) + return -2; /* error */ - if(items < 1) - return; + findstr = strdup(str); + findstr = strupper(findstr); - for( i = (curitem < LAST_ITEM) && next ? curitem+1 : curitem; - i < items; i++ ) { - strncpy(tmp, database[i][NAME], MAX_FIELD_LEN - 1); + for( i = start; i < items; i++ ) { + tmp = strdup(database[i][NAME]); if( strstr(strupper(tmp), findstr) != NULL ) { - curitem = i; - refresh_list(); - break; - } - } -} - - -void -print_number_of_items() -{ - char *str = mkstr(" " "|%3d/%3d", selected_items(), items); - - mvaddstr(0, COLS-strlen(str), str); - - free(str); -} - -void -read_database() -{ - if(items > 0) { - statusline_addstr("Your current data will be lost - Press 'y' to continue"); - switch( getch() ) { - case 'y': - case 'Y': break; - default: clear_statusline(); - return; + ret = i; + goto out; } - clear_statusline(); + my_free(tmp); } - load_database(datafile); - refresh_list(); +out: + free(findstr); + free(tmp); + return ret; } -void -print_database() +int +is_selected(int item) { - FILE *handle; - char *command = options_get_str("print_command"); - - statusline_addstr("Print addressbook? (y/N)"); - switch( getch() ) { - case 'y': - case 'Y': - break; - default: clear_statusline(); return; - } - clear_statusline(); - - if( ! *command || (handle = popen(command, "w")) == NULL) - return; - - fexport("text", handle); - - pclose(handle); + return selected[item]; } - diff --git a/database.h b/database.h index 9ab2c0c..0c47fd4 100644 --- a/database.h +++ b/database.h @@ -43,15 +43,13 @@ int save_database(); void close_database(); int add_item2database(list_item item); void free_list_item(list_item item); -void remove_items(); +void remove_selected_items(); void sort_surname(); void sort_database(); -void clear_database(); -void find(int next); -void print_number_of_items(); -void read_database(); char *get_surname(char *s); -void print_database(); +int find_item(char *str, int start); +int is_selected(int item); + #define LAST_ITEM (items - 1) diff --git a/edit.c b/edit.c index d06c20a..83f4beb 100644 --- a/edit.c +++ b/edit.c @@ -10,6 +10,7 @@ #include #include #include "abook_curses.h" +#include "ui.h" #include "abook.h" #include "database.h" #include "list.h" @@ -42,7 +43,7 @@ editor_tab(int tab) "/ OTHER \\" }; - mvwhline(editw, TABLINE+1, 0, ACS_HLINE, EDITW_COLS); + mvwhline(editw, TABLINE+1, 0, UI_HLINE_CHAR, EDITW_COLS); for(i=0; i < TABS; i++) mvwaddstr(editw, TABLINE, 16 * i + 3, tab_names[i]); @@ -371,7 +372,7 @@ edit_loop(int item) case KEY_RIGHT: tab = tab == MAX_TAB ? 0 : tab + 1; break; case 'r': roll_emails(item); break; - case '?': display_editor_help(editw); break; + case '?': display_help(HELP_EDITOR); break; case 'u': edit_undo(item, RESTORE_ITEM); break; case 12 : clearok(stdscr, 1); break; /* ^L (refresh screen) */ default: return edit_field(tab, c, item); diff --git a/list.c b/list.c index fd1c706..cf2befa 100644 --- a/list.c +++ b/list.c @@ -9,8 +9,8 @@ #include #include -#include "abook_curses.h" #include "abook.h" +#include "ui.h" #include "database.h" #include "edit.h" #include "list.h" @@ -48,7 +48,7 @@ refresh_list() werase(list); - print_number_of_items(); + ui_print_number_of_items(); if( items < 1 ) { refresh(); @@ -291,3 +291,16 @@ invert_selection() selected[i] = !selected[i]; } +inline int +list_current_item() +{ + return curitem; +} + +inline int +list_is_empty() +{ + return items < 1 ? 1 : 0; +} + + diff --git a/list.h b/list.h index f76928e..2b81cda 100644 --- a/list.h +++ b/list.h @@ -1,6 +1,7 @@ #ifndef _LIST_H #define _LIST_H +#include "ui.h" void init_list(); void close_list(); @@ -19,6 +20,8 @@ void goto_end(); void highlight_line(WINDOW *win, int line); int selected_items(); void invert_selection(); +int list_current_item(); +int list_is_empty(); enum { diff --git a/options.c b/options.c index 4776067..103c180 100644 --- a/options.c +++ b/options.c @@ -88,15 +88,6 @@ close_config() conff_free_nodes(abook_config); } -void -edit_options() -{ - /* - * not yet implemented - * edit your ~/.abook.conf manually - */ -} - static int rcfile_exist() { diff --git a/options.h b/options.h index 1aea84f..7e3ee27 100644 --- a/options.h +++ b/options.h @@ -9,7 +9,6 @@ int options_get_int(char *key); char *options_get_str(char *key); void init_options(); -void edit_options(); void close_config(); void load_options(); void save_options(); diff --git a/ui.c b/ui.c new file mode 100644 index 0000000..3286d21 --- /dev/null +++ b/ui.c @@ -0,0 +1,611 @@ + +/* + * $Id$ + * + * by JH + * + * Copyright (C) Jaakko Heinonen + */ + +#include +#include +#include +#include +#include +#include +#include "abook.h" +#include "ui.h" +#include "edit.h" +#include "database.h" +#include "list.h" +#include "misc.h" +#include "options.h" +#include "filter.h" +#include "estr.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 + +#ifdef USE_ASCII_ONLY +# define UI_HLINE_CHAR '-' +#else +# define UI_HLINE_CHAR ACS_HLINE +#endif + + +/* + * external variables + */ + +extern int items, curitem; +extern char *datafile; + +/* + * internal variables + */ + +int ui_initialized = FALSE; + +int should_resize = FALSE; +int can_resize = FALSE; + +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); +} + +static void +free_windows() +{ + delwin(top); + delwin(bottom); +} + + +#ifdef SIGWINCH +static void +resize_abook() +{ +#ifdef TIOCGWINSZ + struct winsize 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); + } +#endif + + if(winsz.ws_col >= MIN_COLS && winsz.ws_row >= MIN_LINES) { +#ifdef HAVE_RESIZETERM + resizeterm(winsz.ws_row, winsz.ws_col); +#else + COLS = winsz.ws_col; + LINES = winsz.ws_row; +#endif + } + + should_resize = FALSE; + close_list(); /* we need to recreate windows */ + init_list(); + free_windows(); + init_windows(); + refresh_screen(); + refresh(); +#endif /* TIOCGWINSZ */ +} + + +static void +win_changed(int i) +{ + if( can_resize ) + resize_abook(); + else + should_resize = TRUE; +} +#endif /* SIGWINCH */ + + +int +is_ui_initialized() +{ + return ui_initialized; +} + + +int +init_ui() +{ + initscr(); cbreak(); noecho(); + nonl(); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); +#ifdef DEBUG + fprintf(stderr, "init_abook():\n"); + fprintf(stderr, " COLS = %d, LINES = %d\n", COLS, LINES); +#endif + if( LINES < MIN_LINES || COLS < MIN_COLS ) { + clear(); refresh(); endwin(); + fprintf(stderr, "Your terminal size is %dx%d\n", COLS, LINES); + fprintf(stderr, "Terminal is too small. Minium terminal size " + "for abook is " + "%dx%d\n", MIN_COLS, MIN_LINES); + return 1; + } + +#ifdef SIGWINCH + signal(SIGWINCH, win_changed); +#endif + + init_list(); + init_windows(); + + ui_initialized = TRUE; + + return 0; +} + +void +close_ui() +{ + close_list(); + free_windows(); + clear(); + refresh(); + endwin(); + + ui_initialized = FALSE; +} + + +void +headerline(char *str) +{ + werase(top); + + mvwhline(top, 1, 0, UI_HLINE_CHAR, COLS); + + mvwprintw(top, 0, 0, "%s | %s", PACKAGE " " VERSION, str); + + refresh(); + wrefresh(top); +} + + +void +refresh_screen() +{ +#ifdef SIGWINCH + if( should_resize ) { + resize_abook(); + return; + } +#endif + clear(); + + refresh_statusline(); + headerline(MAIN_HELPLINE); + list_headerline(); + + refresh_list(); +} + + +void +statusline_msg(char *msg) +{ + clear_statusline(); + statusline_addstr(msg); + getch(); +#ifdef DEBUG + fprintf(stderr, "statusline_msg(\"%s\")\n", msg); +#endif + clear_statusline(); +} + +void +statusline_addstr(char *str) +{ + mvwaddstr(bottom, 1, 0, str); + refresh(); + wrefresh(bottom); +} + +/* + * function statusline_getnstr + * + * parameters: + * (char *str) + * if n >= 0 str is a pointer which points a place where to store + * the string, else str is ingnored + * (int n) + * the maximum length of the string + * If n < 0 function will allocate needed space for the string. + * Value 0 is not allowed for n. + * (int use_filesel) + * if this value is nonzero the fileselector is enabled + * + * returns (char *) + * If n < 0 a pointer to a newly allocated string is returned. + * If n > 0 a nonzero value is returned if user has typed a valid + * string. If not NULL value is returned. Never really use the + * _pointer_ if n > 0. + * + */ + +char * +statusline_getnstr(char *str, int n, int use_filesel) +{ + char *buf; + int y, x; + + getyx(bottom, y, x); + wmove(bottom, 1, x); + + buf = wenter_string(bottom, n, + (use_filesel ? ESTR_USE_FILESEL:0) | ESTR_DONT_WRAP); + + if(n < 0) + return buf; + + if(buf == NULL) + str[0] = 0; + else + strncpy(str, buf, n); + + str[n-1] = 0; + + free(buf); + + return buf; +} + +void +refresh_statusline() +{ + werase(bottom); + + mvwhline(bottom, 0, 0, UI_HLINE_CHAR, COLS); + mvwhline(bottom, 2, 0, UI_HLINE_CHAR, COLS); + + refresh(); + wrefresh(bottom); +} + + +char * +ask_filename(char *prompt, int flags) +{ + char *buf = NULL; + + clear_statusline(); + + statusline_addstr(prompt); + buf = statusline_getnstr(NULL, -1, flags); + + clear_statusline(); + + return buf; +} + +void +clear_statusline() +{ + wmove(bottom, 1, 0); + wclrtoeol(bottom); + wrefresh(bottom); + refresh(); +} + + +/* + * help - need to rewrite + */ + + +#include "help.h" + +void +display_help(int help) +{ + int i; + char **tbl; + WINDOW *helpw; + + switch(help) { + case HELP_MAIN: + tbl = mainhelp; + break; + case HELP_EDITOR: + tbl = editorhelp; + break; + default:return; + } + + helpw = newwin(LINES - 5, COLS - 6, 2, 3); + erase(); + headerline("help"); + + for( i = 0; tbl[i] != NULL; i++) { + waddstr(helpw, tbl[i]); + if( ( !( (i+1) % (LINES-8) ) ) || + (tbl[i+1] == NULL) ) { + refresh(); + wrefresh(helpw); + refresh_statusline(); + statusline_msg("Press any key to continue..."); + wclear(helpw); + } + } + + clear_statusline(); + delwin(helpw); +} + + +/* + * end of help + */ + +char *selected; +extern int curitem; + +void +get_commands() +{ + int ch; + + for(;;) { + can_resize = TRUE; /* it's safe to resize now */ + hide_cursor(); + if( should_resize ) + refresh_screen(); + ch = getch(); + show_cursor(); + can_resize = FALSE; /* it's not safe to resize anymore */ + switch( ch ) { + case 'q': return; + case '?': + display_help(HELP_MAIN); + refresh_screen(); + break; + case 'a': add_item(); break; + case '\r': edit_item(-1); break; + case KEY_DC: + case 'd': + case 'r': ui_remove_items(); break; + case 12: refresh_screen(); break; + + case 'k': + case KEY_UP: scroll_up(); break; + case 'j': + case KEY_DOWN: scroll_down(); break; + case 'K': + case KEY_PPAGE: page_up(); break; + case 'J': + case KEY_NPAGE: page_down(); break; + + case 'H': + case KEY_HOME: goto_home(); break; + case 'E': + case KEY_END: goto_end(); break; + + case 'w': save_database(); + break; + case 'l': ui_read_database(); break; + case 'i': import_database(); break; + case 'e': export_database(); break; + case 'C': ui_clear_database(); break; + + case 'o': ui_open_datafile(); break; + + case 's': sort_database(); break; + case 'S': sort_surname(); break; + + case '/': ui_find(0); break; + case '\\': ui_find(1); break; + + case ' ': if(curitem >= 0) { + selected[curitem] = !selected[curitem]; + ui_print_number_of_items(); + refresh_list(); + } + break; + case '+': select_all(); + refresh_list(); + break; + case '-': select_none(); + refresh_list(); + break; + case '*': invert_selection(); + refresh_list(); + break; + case 'A': move_curitem(MOVE_ITEM_UP); + break; + case 'Z': move_curitem(MOVE_ITEM_DOWN); + break; + + case 'm': launch_mutt(); break; + + case 'p': ui_print_database(); break; + + case 'u': launch_lynx(); break; + } + } +} + + +void +ui_remove_items() +{ + if( items < 1 || curitem < 0 ) + return; + + statusline_addstr("Remove selected item(s) (Y/n)"); + switch( getch() ) { + case '\r': + case 'y': + case 'Y': break; + default: + clear_statusline(); + return; + } + + remove_selected_items(); + + clear_statusline(); + refresh_list(); +} + +void +ui_clear_database() +{ + + statusline_addstr("Clear WHOLE database (y/N)"); + switch( getch() ) { + case 'y': + case 'Y': break; + default: + clear_statusline(); + return; + } + + close_database(); + + refresh_screen(); +} + +void +ui_find(int next) +{ + int item; + static char findstr[81]; + + if(next) { + if( !*findstr ) + return; + } else { + clear_statusline(); + statusline_addstr("/"); + statusline_getnstr(findstr, 67, 0); + clear_statusline(); + } + + if( (item = find_item(findstr, next ? curitem+1 : curitem)) >= 0 ) { + curitem = item; + refresh_list(); + } + +} + + +void +ui_print_number_of_items() +{ + char *str = mkstr(" " "|%3d/%3d", selected_items(), items); + + mvaddstr(0, COLS-strlen(str), str); + + free(str); +} + +void +ui_read_database() +{ + if(items > 0) { + statusline_addstr("Your current data will be lost - Press 'y' to continue"); + switch( getch() ) { + case 'y': + case 'Y': break; + default: clear_statusline(); + return; + } + clear_statusline(); + } + + load_database(datafile); + refresh_list(); +} + + +void +ui_print_database() +{ + FILE *handle; + char *command = options_get_str("print_command"); + + statusline_addstr("Print addressbook? (y/N)"); + switch( getch() ) { + case 'y': + case 'Y': + break; + default: clear_statusline(); return; + } + clear_statusline(); + + if( ! *command || (handle = popen(command, "w")) == NULL) + return; + + fexport("text", handle); + + pclose(handle); +} + + +void +ui_open_datafile() +{ + char *filename; + + filename = ask_filename("File to open: ", 1); + + if( !filename ) { + refresh_screen(); + return; + } + + if( options_get_int("autosave") ) + save_database(); + else { + statusline_addstr("Save current database (y/N)"); + switch( getch() ) { + case 'y': + case 'Y': + save_database(); + default: break; + } + } + + close_database(); + + load_database(filename); + + if( items == 0 ) { + statusline_msg("Sorry, that specified file appears not to be a valid abook addressbook"); + load_database(datafile); + } else { + free(datafile); + datafile = strdup(filename); + } + + refresh_screen(); + free(filename); +} diff --git a/ui.h b/ui.h new file mode 100644 index 0000000..fa20dd2 --- /dev/null +++ b/ui.h @@ -0,0 +1,41 @@ +#ifndef _UI_H +#define _UI_H + +#include "abook_curses.h" + +enum { + HELP_MAIN, + HELP_EDITOR +}; + + +int is_ui_initialized(); +int init_ui(); +void close_ui(); +void headerline(char *str); +void refresh_screen(); +void statusline_msg(char *msg); +char *ask_filename(char *prompt, int flags); +void clear_statusline(); +void display_help(int help); +void statusline_addstr(char *str); +char *statusline_getnstr(char *str, int n, int use_filesel); +void refresh_statusline(); +void get_commands(); +void ui_remove_items(); +void ui_clear_database(); +void ui_find(int next); +void ui_print_number_of_items(); +void ui_read_database(); +char *get_surname(char *s); +void ui_print_database(); +void ui_open_datafile(); + + +#ifdef USE_ASCII_ONLY +# define UI_HLINE_CHAR '-' +#else +# define UI_HLINE_CHAR ACS_HLINE +#endif + +#endif