Import dialog 1.1-20110707. This adds support for several features (e.g.

--hline) found in the old FreeBSD dialog.
This commit is contained in:
Nathan Whitehorn 2011-07-14 13:57:13 +00:00
parent d9bc2c28cd
commit 7214752630
43 changed files with 3764 additions and 1559 deletions

89
CHANGES
View File

@ -1,9 +1,94 @@
-- $Id: CHANGES,v 1.333 2011/03/02 10:06:37 tom Exp $
-- $Id: CHANGES,v 1.360 2011/07/07 23:35:10 tom Exp $
-- Thomas E. Dickey <dickey@invisible-island.net>
This version of dialog was originally from a Debian snapshot. I've done this
to it:
2011/07/07
+ modify util.c to work better with old versions of ncurses:
+ suppress use of wchgat() before fix in 20060715 which is needed
for simple shadow manipulation used here in 2011/06/30 (report
by xDog Walker).
+ add a null-pointer check in dlg_print_scrolled()
+ fix a regression in dlg_getc() introduced by changes to intercept
F1 for help-popup (report by xDog Walker).
2011/06/30
+ correct license statement for prgbox.c (Debian #632198).
+ correct layout when "--colors" is used, by discounting characters in
the escape sequences from the column counts (report by xDog Walker).
+ modify dlg_checklist() so that only one item in the list can
initially be selected (report by xDog Walker).
+ add/use macro dlg_enter_buttoncode() to improve implementation of
"--nook" option (report by xDog Walker).
+ add option "--no-nl-expand" to suppress the conversion of "\n"
strings into newlines (request by xDog Walker).
+ modify LIB_CREATE symbol in makefile.in to include the library
dependencies such as ncurses. This is needed when dynamically
loading the library (report/analysis by xDog Walker).
+ modify dlg_exit_label() to suppress the Cancel button, for
consistency.
+ modify dlg_exit_label() to honor the --nook option, except when there
is no other button, e.g., the help-button.
+ modify dlg_exit_buttoncode() so that it returns the proper code for
help-button (report by xDog Walker).
+ correct loop limit when processing "--column-separator" (report by
xDog Walker).
+ modify handling of "--version" and "--help" to ensure that they are
processed, and exit before widgets. Separate "--print-version"
from "--version", allowing its output to be interspersed with
widget output (report by xDog Walker).
+ correct a few places where "--version" or "--help" options went
always to stdout rather than allowing redirection with the "--stderr"
option (report by xDog Walker).
+ improve repainting after erasing a widget and its shadow.
+ add "--hline" and "--hfile" options for compatibility with FreeBSD
dialog (request by Devin Teske).
+ add dialog version message when opening a trace file (request by
xDog Walker).
+ show filename of rc-file in traces.
+ add piped-in data for gauge widget to traces.
+ add entrypoints to gauge widget, for allocating, updating and freeing
the widget (adapted from patch by Stephen Hurd).
+ fix a reference to freed memory in the gauge widget.
+ fix --no-mouse option by actually closing the mouse (report by
xDog Walker).
+ add sk.po from
http://translationproject.org/latest/dialog/
+ limit Solaris xpg4 portability fix for redefinition of ERR to cover
the specific value found in <sys/regset.h>, in case an application
includes dialog.h after curses.h (FreeBSD #156601, report by Jaakko
Heinonen, Stephen Hurd).
+ updated configure macros:
+ CF_CURSES_CPPFLAGS,
+ CF_CURSES_LIBS, make checks for special libraries on hpux10 and
sunos4 optional
+ CF_CURSES_FUNCS, workaround for bug in gcc 4.2.1 (FreeBSD 8.1)
which caused part of test program to be omitted, i.e., when it saw
two return-statements in a row it omitted the _first_ one. Also
add expression to pointer check to help FreeBSD's linker decide it
should be validated. Just an assignment was not enough. Also, add
check for unctrl.h
+ CF_CURSES_HEADER, change order for curses.h / ncurses.h pairs to
put ncurses.h first, which will tend to provide the same #define's
as in CF_NCURSES_HEADER (report by Dennis Preiser).
+ CF_CURSES_TERM_H, modify to avoid spurious check for
<curses.hterm.h> if there is no ncurses version. Look for
ncurses's term.h anyway, to work around breakage by packagers who
separate ncurses' header files.
+ CF_DISABLE_RPATH_HACK, fix garbled message
+ CF_LD_RPATH_OPT, add mirbsd
+ CF_MAKEFLAGS, filter out GNU make's entering/leaving messages.
This only appeared when using the macro in a dpkg script, though it
should have in other cases.
+ CF_RPATH_HACK, add a check for libraries not found, e.g., from
suppressed functionality of gcc in linking from /usr/local/lib, and
add a -L option to help work around this.
+ CF_XOPEN_SOURCE, workaround for cygwin to get ncurses' configure
script to define _XOPEN_SOURCE_EXTENDED (cygwin's features.h
doesn't do anything, so it needs a crutch).
+ updated config.guess, config.sub
2011/03/02
+ add --prgbox and --programbox (adapted from patch by David Boyd).
+ add sl.po from
@ -649,7 +734,7 @@ to it:
colors to be the same, provided that bold attribute is set.
Also improved the logic for choosing a background color when the
foreground and background are the same (report by Erika Pacholleck).
+ update configure script macro CF_XOPEN_SOURCE, ensuring that the
+ updated configure script macro CF_XOPEN_SOURCE, ensuring that the
_POSIX_C_SOURCE value is defined with a specific value (bug report
originally for lynx).
+ fix configure script so that po/makefile is generated properly when

View File

@ -1 +1 @@
9:0:0 1.1 20110302
10:0:0 1.1 20110707

199
aclocal.m4 vendored
View File

@ -1,5 +1,5 @@
dnl macros used for DIALOG configure script
dnl $Id: aclocal.m4,v 1.80 2011/01/18 23:17:01 tom Exp $
dnl $Id: aclocal.m4,v 1.82 2011/06/28 22:48:31 tom Exp $
dnl ---------------------------------------------------------------------------
dnl Copyright 1999-2010,2011 -- Thomas E. Dickey
dnl
@ -1128,7 +1128,7 @@ CF_NCURSES_VERSION
CF_CURSES_LIBS
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11
dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
dnl ------------------
dnl Look for the curses headers.
AC_DEFUN([CF_CURSES_CPPFLAGS],[
@ -1137,13 +1137,19 @@ AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
cf_cv_curses_incdir=no
case $host_os in #(vi
hpux10.*) #(vi
test -d /usr/include/curses_colr && \
cf_cv_curses_incdir="-I/usr/include/curses_colr"
if test "x$cf_cv_screen" = "xcurses_colr"
then
test -d /usr/include/curses_colr && \
cf_cv_curses_incdir="-I/usr/include/curses_colr"
fi
;;
sunos3*|sunos4*)
test -d /usr/5lib && \
test -d /usr/5include && \
cf_cv_curses_incdir="-I/usr/5include"
if test "x$cf_cv_screen" = "xcurses_5lib"
then
test -d /usr/5lib && \
test -d /usr/5include && \
cf_cv_curses_incdir="-I/usr/5include"
fi
;;
esac
])
@ -1153,7 +1159,7 @@ CF_CURSES_HEADER
CF_TERM_HEADER
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_FUNCS version: 15 updated: 2010/10/23 15:52:32
dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
dnl ---------------
dnl Curses-functions are a little complicated, since a lot of them are macros.
AC_DEFUN([CF_CURSES_FUNCS],
@ -1161,6 +1167,7 @@ AC_DEFUN([CF_CURSES_FUNCS],
AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
AC_REQUIRE([CF_XOPEN_CURSES])
AC_REQUIRE([CF_CURSES_TERM_H])
AC_REQUIRE([CF_CURSES_UNCTRL_H])
for cf_func in $1
do
CF_UPPER(cf_tr_func,$cf_func)
@ -1173,7 +1180,8 @@ do
[
#ifndef ${cf_func}
long foo = (long)(&${cf_func});
${cf_cv_main_return:-return}(foo == 0);
if (foo + 1234 > 5678)
${cf_cv_main_return:-return}(foo);
#endif
],
[cf_result=yes],
@ -1190,7 +1198,7 @@ ${cf_cv_main_return:-return}(foo == 0);
done
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16
dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
dnl ----------------
dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
dnl variations of ncurses' installs.
@ -1200,10 +1208,10 @@ AC_DEFUN([CF_CURSES_HEADER],[
AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
cf_cv_ncurses_header=none
for cf_header in ifelse($1,,,[ \
$1/curses.h \
$1/ncurses.h]) \
curses.h \
ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h])
$1/ncurses.h \
$1/curses.h]) \
ncurses.h \
curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
do
AC_TRY_COMPILE([#include <${cf_header}>],
[initscr(); tgoto("?", 0,0)],
@ -1219,7 +1227,7 @@ fi
AC_CHECK_HEADERS($cf_cv_ncurses_header)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_LIBS version: 32 updated: 2011/01/16 17:43:15
dnl CF_CURSES_LIBS version: 34 updated: 2011/04/09 14:51:08
dnl --------------
dnl Look for the curses libraries. Older curses implementations may require
dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
@ -1239,19 +1247,26 @@ freebsd*) #(vi
AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
;;
hpux10.*) #(vi
AC_CHECK_LIB(cur_colr,initscr,[
CF_ADD_LIBS(-lcur_colr)
ac_cv_func_initscr=yes
],[
AC_CHECK_LIB(Hcurses,initscr,[
# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
CF_ADD_LIBS(-lHcurses)
CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
ac_cv_func_initscr=yes
])])
# Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
# next (1998), and xcurses "newer" (2000). There is no header file for
# Hcurses; the subdirectory curses_colr has the headers (curses.h and
# term.h) for cur_colr
if test "x$cf_cv_screen" = "xcurses_colr"
then
AC_CHECK_LIB(cur_colr,initscr,[
CF_ADD_LIBS(-lcur_colr)
ac_cv_func_initscr=yes
],[
AC_CHECK_LIB(Hcurses,initscr,[
# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
CF_ADD_LIBS(-lHcurses)
CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
ac_cv_func_initscr=yes
])])
fi
;;
linux*)
case `arch` in
case `arch 2>/dev/null` in
x86_64)
if test -d /lib64
then
@ -1266,9 +1281,12 @@ linux*)
esac
;;
sunos3*|sunos4*)
if test -d /usr/5lib ; then
CF_ADD_LIBDIR(/usr/5lib)
CF_ADD_LIBS(-lcurses -ltermcap)
if test "x$cf_cv_screen" = "xcurses_5lib"
then
if test -d /usr/5lib ; then
CF_ADD_LIBDIR(/usr/5lib)
CF_ADD_LIBS(-lcurses -ltermcap)
fi
fi
ac_cv_func_initscr=yes
;;
@ -1333,7 +1351,7 @@ fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_TERM_H version: 8 updated: 2010/10/23 15:54:49
dnl CF_CURSES_TERM_H version: 9 updated: 2011/04/09 18:19:55
dnl ----------------
dnl SVr4 curses should have term.h as well (where it puts the definitions of
dnl the low-level interface). This may not be true in old/broken implementations,
@ -1347,9 +1365,17 @@ AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
# for <term.h> if we do not find the variant.
for cf_header in \
`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \
term.h
cf_header_list="term.h ncurses/term.h ncursesw/term.h"
case ${cf_cv_ncurses_header:-curses.h} in #(vi
*/*)
cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
cf_header_list="$cf_header_item $cf_header_list"
;;
esac
for cf_header in $cf_header_list
do
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
@ -1395,6 +1421,61 @@ ncursesw/term.h)
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_UNCTRL_H version: 1 updated: 2011/04/09 18:19:55
dnl ------------------
dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
dnl may put it in a subdirectory (along with ncurses' other headers, of
dnl course). Packages which put the headers in inconsistent locations are
dnl broken).
AC_DEFUN([CF_CURSES_UNCTRL_H],
[
AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
# for <unctrl.h> if we do not find the variant.
cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
case ${cf_cv_ncurses_header:-curses.h} in #(vi
*/*)
cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
cf_header_list="$cf_header_item $cf_header_list"
;;
esac
for cf_header in $cf_header_list
do
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
#include <${cf_header}>],
[WINDOW *x],
[cf_cv_unctrl_header=$cf_header
break],
[cf_cv_unctrl_header=no])
done
case $cf_cv_unctrl_header in #(vi
no)
AC_MSG_WARN(unctrl.h header not found)
;;
esac
])
case $cf_cv_unctrl_header in #(vi
unctrl.h) #(vi
AC_DEFINE(HAVE_UNCTRL_H)
;;
ncurses/unctrl.h) #(vi
AC_DEFINE(HAVE_NCURSES_UNCTRL_H)
;;
ncursesw/unctrl.h)
AC_DEFINE(HAVE_NCURSESW_UNCTRL_H)
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59
dnl ------------------
dnl Check for likely values of wacs_map[].
@ -1518,7 +1599,7 @@ fi
AC_SUBST(LIBTOOL_VERSION)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_DISABLE_RPATH_HACK version: 1 updated: 2010/04/11 10:54:00
dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
dnl ---------------------
dnl The rpath-hack makes it simpler to build programs, particularly with the
dnl *BSD ports which may have essential libraries in unusual places. But it
@ -1526,7 +1607,7 @@ dnl can interfere with building an executable for the base system. Use this
dnl option in that case.
AC_DEFUN([CF_DISABLE_RPATH_HACK],
[
AC_MSG_CHECKING(if rpath should be not be set)
AC_MSG_CHECKING(if rpath-hack should be disabled)
CF_ARG_DISABLE(rpath-hack,
[ --disable-rpath-hack don't add rpath options for additional libraries],
[cf_disable_rpath_hack=yes],
@ -2256,7 +2337,7 @@ ifdef([AC_FUNC_FSEEKO],[
])
])
dnl ---------------------------------------------------------------------------
dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05
dnl CF_LD_RPATH_OPT version: 4 updated: 2011/06/04 20:09:13
dnl ---------------
dnl For the given system and compiler, find the compiler flags to pass to the
dnl loader to use the "rpath" feature.
@ -2277,7 +2358,7 @@ irix*) #(vi
linux*|gnu*|k*bsd*-gnu) #(vi
LD_RPATH_OPT="-Wl,-rpath,"
;;
openbsd[[2-9]].*) #(vi
openbsd[[2-9]].*|mirbsd*) #(vi
LD_RPATH_OPT="-Wl,-rpath,"
;;
freebsd*) #(vi
@ -2356,7 +2437,7 @@ ifelse($1,,,[$1=$LIB_PREFIX])
AC_SUBST(LIB_PREFIX)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MAKEFLAGS version: 13 updated: 2010/10/23 15:52:32
dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
dnl ------------
dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
@ -2373,7 +2454,7 @@ SHELL = /bin/sh
all :
@ echo '.$cf_option'
CF_EOF
cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[ ]]*$,,'`
cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'`
case "$cf_result" in
.*k)
cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
@ -3107,7 +3188,7 @@ $1=`echo "$2" | \
-e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_RPATH_HACK version: 8 updated: 2010/04/17 15:38:58
dnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33
dnl -------------
AC_DEFUN([CF_RPATH_HACK],
[
@ -3120,9 +3201,36 @@ if test -n "$LD_RPATH_OPT" ; then
cf_rpath_list="/usr/lib /lib"
if test "$cf_ldd_prog" != no
then
cf_rpath_oops=
AC_TRY_LINK([#include <stdio.h>],
[printf("Hello");],
[cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`])
[cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u`
cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`])
# If we passed the link-test, but get a "not found" on a given library,
# this could be due to inept reconfiguration of gcc to make it only
# partly honor /usr/local/lib (or whatever). Sometimes this behavior
# is intentional, e.g., installing gcc in /usr/bin and suppressing the
# /usr/local libraries.
if test -n "$cf_rpath_oops"
then
for cf_rpath_src in $cf_rpath_oops
do
for cf_rpath_dir in \
/usr/local \
/usr/pkg \
/opt/sfw
do
if test -f $cf_rpath_dir/lib/$cf_rpath_src
then
CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
break
fi
done
done
fi
fi
CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
@ -3572,7 +3680,7 @@ if test "$with_dmalloc" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_LIBTOOL version: 26 updated: 2010/10/23 15:55:24
dnl CF_WITH_LIBTOOL version: 27 updated: 2011/06/28 18:45:38
dnl ---------------
dnl Provide a configure option to incorporate libtool. Define several useful
dnl symbols for the makefile rules.
@ -3648,7 +3756,7 @@ ifdef([AC_PROG_LIBTOOL],[
AC_MSG_ERROR(Cannot find libtool)
fi
])dnl
LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o'
LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
LIB_OBJECT='${OBJECTS:.o=.lo}'
LIB_SUFFIX=.la
LIB_CLEAN='${LIBTOOL} --mode=clean'
@ -3842,7 +3950,7 @@ AC_TRY_LINK([
test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37
dnl ---------------
dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
dnl or adapt to the vendor's definitions to get equivalent functionality,
@ -3861,6 +3969,9 @@ case $host_os in #(vi
aix[[456]]*) #(vi
cf_xopen_source="-D_ALL_SOURCE"
;;
cygwin) #(vi
cf_XOPEN_SOURCE=600
;;
darwin[[0-8]].*) #(vi
cf_xopen_source="-D_APPLE_C_SOURCE"
;;

View File

@ -1,5 +1,5 @@
/*
* $Id: arrows.c,v 1.33 2011/01/19 00:27:53 tom Exp $
* $Id: arrows.c,v 1.36 2011/06/27 09:13:56 tom Exp $
*
* arrows.c -- draw arrows to indicate end-of-range for lists
*
@ -36,6 +36,10 @@
#define add_acs(win, code) waddch(win, dlg_boxchar(code))
#endif
/* size of decorations */
#define ON_LEFT 4
#define ON_RIGHT 3
#ifdef HAVE_COLOR
static chtype
merge_colors(chtype foreground, chtype background)
@ -59,6 +63,36 @@ merge_colors(chtype foreground, chtype background)
#define merge_colors(f,b) (f)
#endif
/*
* If we have help-line text, e.g., from "--hline", draw it between the other
* decorations at the bottom of the dialog window.
*/
void
dlg_draw_helpline(WINDOW *win, bool decorations)
{
int cur_x, cur_y;
int bottom;
if (dialog_vars.help_line != 0
&& (bottom = getmaxy(win) - 1) > 0) {
chtype attr = A_NORMAL;
const int *cols = dlg_index_columns(dialog_vars.help_line);
int other = decorations ? (ON_LEFT + ON_RIGHT) : 0;
int avail = (getmaxx(win) - other - 2);
int limit = dlg_limit_columns(dialog_vars.help_line, avail, 0);
if (limit > 0) {
getyx(win, cur_y, cur_x);
other = decorations ? ON_LEFT : 0;
(void) wmove(win, bottom, other + (avail - limit) / 2);
waddch(win, '[');
dlg_print_text(win, dialog_vars.help_line, cols[limit], &attr);
waddch(win, ']');
wmove(win, cur_y, cur_x);
}
}
}
void
dlg_draw_arrows2(WINDOW *win,
int top_arrow,
@ -94,7 +128,7 @@ dlg_draw_arrows2(WINDOW *win,
(void) waddstr(win, "(-)");
} else {
wattrset(win, attr);
(void) whline(win, dlg_boxchar(ACS_HLINE), 4);
(void) whline(win, dlg_boxchar(ACS_HLINE), ON_LEFT);
}
}
mouse_mkbutton(top, x - 1, 6, KEY_PPAGE);
@ -106,7 +140,7 @@ dlg_draw_arrows2(WINDOW *win,
(void) waddstr(win, "(+)");
} else {
wattrset(win, borderattr);
(void) whline(win, dlg_boxchar(ACS_HLINE), 4);
(void) whline(win, dlg_boxchar(ACS_HLINE), ON_LEFT);
}
mouse_mkbutton(bottom, x - 1, 6, KEY_NPAGE);
@ -141,6 +175,7 @@ dlg_draw_scrollbar(WINDOW *win,
getyx(win, oldy, oldx);
getmaxyx(win, maxy, maxx);
dlg_draw_helpline(win, TRUE);
if (bottom_arrow || top_arrow || dialog_state.use_scrollbar) {
percent = (!total_data
? 100
@ -213,6 +248,7 @@ dlg_draw_arrows(WINDOW *win,
int top,
int bottom)
{
dlg_draw_helpline(win, TRUE);
dlg_draw_arrows2(win,
top_arrow,
bottom_arrow,

View File

@ -1,5 +1,5 @@
/*
* $Id: buttons.c,v 1.84 2011/01/19 00:27:53 tom Exp $
* $Id: buttons.c,v 1.86 2011/06/28 10:46:46 tom Exp $
*
* buttons.c -- draw buttons, e.g., OK/Cancel
*
@ -442,16 +442,23 @@ const char **
dlg_exit_label(void)
{
const char **result;
DIALOG_VARS save;
if (dialog_vars.extra_button) {
dlg_save_vars(&save);
dialog_vars.nocancel = TRUE;
result = dlg_ok_labels();
dlg_restore_vars(&save);
} else {
static const char *labels[3];
int n = 0;
labels[n++] = my_exit_label();
if (!dialog_vars.nook)
labels[n++] = my_exit_label();
if (dialog_vars.help_button)
labels[n++] = my_help_label();
if (n == 0)
labels[n++] = my_exit_label();
labels[n] = 0;
result = labels;
@ -465,7 +472,17 @@ dlg_exit_label(void)
int
dlg_exit_buttoncode(int button)
{
return dlg_ok_buttoncode(button);
int result;
DIALOG_VARS save;
dlg_save_vars(&save);
dialog_vars.nocancel = TRUE;
result = dlg_ok_buttoncode(button);
dlg_restore_vars(&save);
return result;
}
const char **

View File

@ -1,5 +1,5 @@
/*
* $Id: calendar.c,v 1.60 2011/01/03 23:29:51 tom Exp $
* $Id: calendar.c,v 1.62 2011/06/29 09:47:06 tom Exp $
*
* calendar.c -- implements the calendar box
*
@ -388,6 +388,7 @@ dialog_calendar(const char *title,
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
@ -571,7 +572,7 @@ dialog_calendar(const char *title,
state = sYEAR;
break;
case DLGK_ENTER:
result = dlg_ok_buttoncode(button);
result = dlg_enter_buttoncode(button);
break;
case DLGK_FIELD_PREV:
state = dlg_prev_ok_buttonindex(state, sMONTH);

View File

@ -1,5 +1,5 @@
/*
* $Id: checklist.c,v 1.124 2011/01/19 00:27:53 tom Exp $
* $Id: checklist.c,v 1.127 2011/06/29 23:04:09 tom Exp $
*
* checklist.c -- implements the checklist box
*
@ -149,6 +149,7 @@ dlg_checklist(const char *title,
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ),
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
@ -193,6 +194,24 @@ dlg_checklist(const char *title,
dlg_does_output();
dlg_tab_correct_str(prompt);
/*
* If this is a radiobutton list, ensure that no more than one item is
* selected initially. Allow none to be selected, since some users may
* wish to provide this flavor.
*/
if (flag == FLAG_RADIO) {
bool first = TRUE;
for (i = 0; i < item_no; i++) {
if (items[i].state) {
if (first) {
first = FALSE;
} else {
items[i].state = 0;
}
}
}
}
#ifdef KEY_RESIZE
retry:
#endif
@ -291,11 +310,12 @@ dlg_checklist(const char *title,
choice = max_choice - 1;
}
/* Print the list */
for (i = 0; i < max_choice; i++)
for (i = 0; i < max_choice; i++) {
print_item(list,
&items[i + scrollamt],
states,
i, i == choice);
}
(void) wnoutrefresh(list);
/* register the new window, along with its borders */
@ -565,7 +585,7 @@ dlg_checklist(const char *title,
if (fkey) {
switch (key) {
case DLGK_ENTER:
result = dlg_ok_buttoncode(button);
result = dlg_enter_buttoncode(button);
break;
case DLGK_FIELD_PREV:
button = dlg_prev_button(buttons, button);

View File

@ -1,5 +1,5 @@
/*
* $Id: columns.c,v 1.7 2011/01/16 21:51:44 tom Exp $
* $Id: columns.c,v 1.8 2011/06/28 09:26:23 tom Exp $
*
* columns.c -- implements column-alignment
*
@ -25,7 +25,7 @@
#define each(row, data) \
row = 0, data = target; \
row < num_rows - 1; \
row < num_rows; \
++row, data = next_row(data, per_row)
static char *

37
config.guess vendored
View File

@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2911 Free Software Foundation, Inc.
timestamp='2010-09-24'
timestamp='2011-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -57,8 +57,8 @@ GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -92,7 +92,7 @@ if test $# != 0; then
exit 1
fi
trap 'exit 1' HUP INT TERM
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
@ -106,7 +106,7 @@ trap 'exit 1' HUP INT TERM
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
@ -270,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit ;;
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@ -326,8 +329,8 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
@ -495,7 +498,7 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
@ -820,8 +823,8 @@ EOF
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
@ -934,14 +937,14 @@ EOF
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
echo or32-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;;
echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in

75
config.sub vendored
View File

@ -2,9 +2,9 @@
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# 2011 Free Software Foundation, Inc.
timestamp='2010-09-11'
timestamp='2011-04-01'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -76,8 +76,8 @@ version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -175,10 +175,10 @@ case $os in
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
;;
-hiux*)
os=-hiuxwe2
;;
@ -283,12 +283,13 @@ case $basic_machine in
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be\
| nds32 | nds32le | nds32be \
| nios | nios2 \
| ns16k | ns32k \
| open8 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| rx \
| score \
@ -296,12 +297,12 @@ case $basic_machine in
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
@ -324,7 +325,15 @@ case $basic_machine in
ms1)
basic_machine=mt-unknown
;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
@ -382,24 +391,25 @@ case $basic_machine in
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile-* | tilegx-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
@ -539,7 +549,7 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
cr16)
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
@ -826,10 +836,10 @@ case $basic_machine in
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
next | m*-next)
basic_machine=m68k-next
case $os in
-nextstep* )
-nextstep*)
;;
-ns2*)
os=-nextstep2
@ -948,11 +958,14 @@ case $basic_machine in
pn)
basic_machine=pn-gould
;;
power) basic_machine=power-ibm
power)
basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
ppc | ppcbe)
basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
@ -960,9 +973,11 @@ case $basic_machine in
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
ppc64)
basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
ppc64-*)
basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
@ -1046,6 +1061,9 @@ case $basic_machine in
basic_machine=i860-stratus
os=-sysv4
;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
;;
@ -1178,6 +1196,9 @@ case $basic_machine in
xps | xps100)
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
@ -1400,7 +1421,7 @@ case $os in
-nova*)
os=-rtmk-nova
;;
-ns2 )
-ns2)
os=-nextstep2
;;
-nsk*)
@ -1597,7 +1618,7 @@ case $basic_machine in
m88k-omron*)
os=-luna
;;
*-next )
*-next)
os=-nextstep
;;
*-sequent)

2189
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
dnl $Id: configure.in,v 1.64 2011/03/01 00:59:50 tom Exp $
dnl $Id: configure.in,v 1.65 2011/06/27 10:42:27 tom Exp $
dnl Process this file with autoconf to produce a configure script.
dnl ---------------------------------------------------------------------------
dnl Copyright 1999-2010,2011 -- Thomas E. Dickey
@ -225,6 +225,7 @@ getparx \
getpary \
getparyx \
use_default_colors \
wchgat \
wget_wch \
)

View File

@ -1,5 +1,5 @@
'\" t
.\" $Id: dialog.1,v 1.126 2011/03/02 01:24:21 tom Exp $
.\" $Id: dialog.1,v 1.133 2011/06/29 09:39:29 tom Exp $
.\" Copyright 2005-2010,2011 Thomas E. Dickey
.\"
.\" This program is free software; you can redistribute it and/or modify
@ -36,7 +36,7 @@
.RE
..
.
.TH \*D 1 "" "$Date: 2011/03/02 01:24:21 $"
.TH \*D 1 "" "$Date: 2011/06/29 09:39:29 $"
.SH NAME
\*p \- display dialog boxes from shell scripts
.SH SYNOPSIS
@ -285,8 +285,9 @@ Override the label used for "Extra" buttons.
Note: for inputmenu widgets, this defaults to "Rename".
.
.IP "\fB--help"
Prints the help message to \fB\*p\fP's output.
The help message is printed if no options are given.
Prints the help message to the standard output and exits.
The help message is also printed if no options are given,
or if an unrecognized option is given.
.
.IP "\fB--help-button"
Show a help-button after "OK" and "Cancel" buttons,
@ -307,6 +308,12 @@ after the item-help "HELP" information.
This can be used to reconstruct the state of a checklist after processing
the help request.
.
.IP "\fB--hfile \fIfilename"
Display the given file using a textbox when the user presses F1.
.
.IP "\fB--hline \fIstring"
Display the given string centered at the bottom of the widget.
.
.IP "\fB--ignore"
Ignore options that \fB\*p\fP does not recognize.
Some well-known ones such as "\fB--icon\fP" are ignored anyway,
@ -385,6 +392,10 @@ See also "\fB--ascii-lines\fR".
.IP "\fB--no-mouse
Do not enable the mouse.
.
.IP "\fB--no-nl-expand
Do not convert "\\n" substrings of the message/prompt text into
literal newlines.
.
.IP "\fB--no-ok"
.IP "\fB--nook"
Suppress the "OK" button in checklist, inputbox and menu box modes.
@ -420,8 +431,9 @@ Prints the size of each dialog box to \fB\*p\fP's output.
.IP "\fB--print-version"
Prints \fB\*p\fR's version to \fB\*p\fP's output.
This may be used alone, without other options.
It does not cause \fBdialog\fP to exit by itself.
.
.IP "\fB--scrollbar \fIstring"
.IP "\fB--scrollbar"
For widgets holding a scrollable set of data,
draw a scrollbar on its right-margin.
This does not respond to the mouse.
@ -501,6 +513,7 @@ string to be displayed at the top of the dialog box.
logs the command-line parameters and
keystrokes to the given file.
If \fBdialog\fP reads a configure file, it is logged as well.
Piped input to the \fIgauge\fP widget is logged.
Use control/T to log a picture of the current dialog window.
.
.IP "\fB--trim"
@ -511,7 +524,8 @@ trim literal newlines and repeated blanks from message text.
See also the "\fB--cr-wrap\fR" and "\fB--no-collapse\fR" options.
.
.IP "\fB--version"
Same as "\fB--print-version\fP".
Prints \fB\*p\fR's version to the standard output, and exits.
See also "\fB--print-version\fP".
.
.IP "\fB--visit-items"
Modify the tab-traversal of checklist, radiobox, menubox and inputmenu
@ -1278,12 +1292,13 @@ also does not work for common options of \*p, such as the gauge box.
original dialog 0.4 program.
.PP
\fBwhiptail\fP's manpage borrows features from \fB\*p\fP, e.g.,
\fB--default-item\fP, \fB--output-fd\fP,
but oddly cites only \fB\*p\fP versions up to 0.4 as a source.
\fB--default-item\fP (2000),
\fB--output-fd\fP (2002),
but oddly cites only \fB\*p\fP versions up to 0.4 (1996) as a source.
That is, its manpage refers to features which
were borrowed from more recent versions of \fB\*p\fP, e.g.,
the \fB--gauge\fP and \fB--password\fP boxes,
as well as options such as \fB-separate-output\fP.
as well as options such as \fB-separate-output\fP (2008).
Somewhat humorously, one may note that the \fBpopt\fP feature
(undocumented in its manpage)
of using a "--" as an escape was documented in \fB\*p\fP's manpage about

541
dialog.3
View File

@ -1,4 +1,4 @@
.\" $Id: dialog.3,v 1.60 2011/03/02 10:19:12 tom Exp $
.\" $Id: dialog.3,v 1.68 2011/06/29 09:07:36 tom Exp $
.\" Copyright 2005-2010,2011 Thomas E. Dickey
.\"
.\" This program is free software; you can redistribute it and/or modify
@ -21,11 +21,24 @@
.ds l dialog
.ds L Dialog
.ds D DIALOG
.
.de ES
.ne 8
.IP
..
.de EX
.RS +10
.nf
..
.de EE
.fi
.RE
..
.\" Bulleted paragraph
.de bP
.IP \(bu 4
..
.TH \*D 3 "" "$Date: 2011/03/02 10:19:12 $"
.TH \*D 3 "" "$Date: 2011/06/29 09:07:36 $"
.SH NAME
\*l \- widgets and utilities for the \*p program
.SH SYNOPSIS
@ -66,7 +79,7 @@ Colors and video attributes are categorized and associated with
settings in the configuration file
(see the discussion of \fI$DIALOGRC\fP in \fB\*p\fP(1)).
The \fIDIALOG_ATR(n)\fP macro is used for defining the references
to the combined color and attribute table \fIdlg_color_table[]\fP.
to the combined color and attribute table \fBdlg_color_table[]\fP.
.PP
The \fB\*p\fP application passes its command-line parameters
to the widget functions. Some of those parameters are single values,
@ -85,7 +98,7 @@ These include definitions based on the generated \fI<dlg_config.h>\fP header.
.SH DATA STRUCTURES
All of the global data for the \fB\*l\fP library is stored in
a few structures: \fIDIALOG_STATE\fP, \fIDIALOG_VARS\fP and \fIDIALOG_COLORS\fP.
The corresponding \fIdialog_state\fP, \fIdialog_vars\fP and \fIdlg_color_table\fP
The corresponding \fBdialog_state\fP, \fBdialog_vars\fP and \fBdlg_color_table\fP
global variables should be initialized to zeros,
and then populated with the data to use.
A few of these must be nonzero for the corresponding widgets to function.
@ -133,7 +146,7 @@ prefer to write results to the standard output,
e.g., by using the "\fB--stdout\fP" option.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_STATE.output_count
This is incremented by \fIdlg_does_output\fP,
This is incremented by \fBdlg_does_output\fP,
which is called by each widget that writes text to the output.
The \fB\*p\fP application uses that to decide if it should
also write a separator, i.e.,
@ -205,12 +218,15 @@ suppress shadows that would be drawn to the right and bottom of each dialog box.
This corresponds to the command-line option "\fB--visit-items\fP".
.\" ---------------------------------------------------------------------------
.PP
The \fB\*p\fP application resets the \fIdialog_vars\fP data before
The \fB\*p\fP application resets the \fBdialog_vars\fP data before
accepting options to invoke each widget.
Most of the \fIDIALOG_VARS\fP members are set directly from \fB\*p\fP's
command-line options:
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.ascii_lines
This corresponds to the command-line option "\fB--ascii-lines\fP.
It causes line-drawing to be done with ASCII characters, e.g., "+" and "-".
See \fIDIALOG_VARS.no_lines\fP.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.backtitle
This corresponds to the command-line option "\fB--backtitle\fP \fIbacktitle\fP".
@ -344,10 +360,20 @@ and the item-help text will be written to \fB\*p\fP's output after the token "HE
Otherwise, the return status will indicate that the Help button was pressed,
and no message printed.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.help_file
This corresponds to the command-line option "\fB--hfile\fP \fIstring\fP".
The given filename is passed to \fBdialog_helpfile\fP when the user
presses F1.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.help_label
This corresponds to the command-line option "\fB--help-label\fP \fIstring\fP".
The given string overrides the label used for "Help" buttons.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.help_line
This corresponds to the command-line option "\fB--hline\fP \fIstring\fP".
The given string is displayed in the bottom of dialog windows,
like a subtitle.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.help_status
This corresponds to the command-line option "\fB--help-status\fP".
If true, and the the help-button is selected,
@ -391,6 +417,10 @@ This corresponds to the command-line option "\fB--insecure\fP".
If true, make the password widget friendlier but less secure,
by echoing asterisks for each character.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.in_helpfile
This variable is used to prevent \fBdialog_helpfile\fP from showing
anything, e.g., if F1 were pressed within a help-file display.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.item_help
This corresponds to the command-line option "\fB--item-help\fP".
If true,
@ -423,6 +453,14 @@ This corresponds to the command-line option "\fB--no-label\fP \fIstring\fP".
The given string overrides the label used for "No" buttons.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.no_lines
This corresponds to the command-line option "\fB--no-lines\fP.
It suppresses line-drawing.
See \fIDIALOG_VARS.ascii_lines\fP.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.no_nl_expand
This corresponds to the command-line option "\fB--no-nl-expand\fP".
If false, \fBdlg_trim_string\fP converts literal "\\n" substrings
in a message into newlines.
.\" ---------------------------------------------------------------------------
.IP \fIDIALOG_VARS.nocancel
This corresponds to the command-line option "\fB--no-cancel\fP".
@ -537,24 +575,31 @@ Other parameters depend on the box type.
.IP \fBdialog_calendar
implements the "\fB--calendar\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP subtitle
.TP 5
.B const char * \fIsubtitle
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the height excluding the fixed-height calendar grid.
.IP width
.TP 5
.B int \fIwidth
is the overall width of the box,
which is adjusted up to the calendar grid's minimum width if needed.
.IP day
.TP 5
.B int \fIday
is the initial day of the week shown,
counting zero as Sunday.
If the value is negative, the current day of the week is used.
.IP month
.TP 5
.B int \fImonth
is the initial month of the year shown,
counting one as January.
If the value is negative, the current month of the year is used.
.IP year
.TP 5
.B int \fIyear
is the initial year shown.
If the value is negative, the current year is used.
.RE
@ -563,22 +608,29 @@ If the value is negative, the current year is used.
implements the "\fB--checklist\fP" and "\fB--radiolist\fP" options
depending on the \fIflag\fP parameter.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is adjusted to use the available screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is adjusted to use the available screen size.
.IP list_height
.TP 5
.B int \fIlist_height
is the minimum height to reserve for displaying the list.
If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
.IP item_no
.TP 5
.B int \fIitem_no
is the number of rows in \fIitems\fP.
.IP items
.TP 5
.B int \fIitems
is an array of strings which is viewed either as a list of rows
.RS
\fItag item status \fR
@ -589,7 +641,7 @@ or
\fItag item status help\fR
.RE
.IP
depending on whether \fIdialog_vars.item_help\fP is set.
depending on whether \fBdialog_vars.item_help\fP is set.
.IP flag
is either \fIFLAG_CHECK\fP, for checklists,
or \fIFLAG_RADIO\fP for radiolists.
@ -598,15 +650,19 @@ or \fIFLAG_RADIO\fP for radiolists.
.IP \fBdialog_dselect
implements the "\fB--dselect\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP path
.TP 5
.B const char * \fIpath
is the preselected value to show in the input-box,
which is used also to set the directory- and file-windows.
.IP height
.TP 5
.B int \fIheight
is the height excluding the minimum needed to show the dialog box framework.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.RE
@ -614,14 +670,18 @@ If zero, the height is based on the screen size.
.IP \fBdialog_editbox
implements the "\fB--editbox\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP file
.TP 5
.B const char * \fIfile
is the name of the file from which to read.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is adjusted to use the available screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is adjusted to use the available screen size.
.RE
@ -629,22 +689,29 @@ If zero, the height is adjusted to use the available screen size.
.IP \fBdialog_form
implements the "\fB--form\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is adjusted to use the available screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is adjusted to use the available screen size.
.IP form_height
.TP 5
.B int \fIform_height
is the minimum height to reserve for displaying the list.
If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
.IP item_no
.TP 5
.B int \fIitem_no
is the number of rows in \fIitems\fP.
.IP items
.TP 5
.B int \fIitems
is an array of strings which is viewed either as a list of rows
.RS
\fIName NameY NameX Text TextY TextX FLen ILen\fR
@ -655,39 +722,53 @@ or
\fIName NameY NameX Text TextY TextX FLen ILen Help\fR
.RE
.IP
depending on whether \fIdialog_vars.item_help\fP is set.
depending on whether \fBdialog_vars.item_help\fP is set.
.RE
.\" ************************************************************************
.IP \fBdialog_fselect
implements the "\fB--fselect\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP path
.TP 5
.B const char * \fIpath
is the preselected value to show in the input-box,
which is used also to set the directory- and file-windows.
.IP height
.TP 5
.B int \fIheight
is the height excluding the minimum needed to show the dialog box framework.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.RE
.\" ************************************************************************
.IP \fBdialog_gauge
implements the "\fB--gauge\fP" option.
Alternatively, a simpler or customized gauge widget can be
setup using
\fBdlg_allocate_gauge\fP,
\fBdlg_update_gauge\fP and
\fBdlg_free_gauge\fP.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP percent
.TP 5
.B int \fIpercent
is the percentage to show in the progress bar.
.RE
.\" ************************************************************************
@ -695,43 +776,79 @@ is the percentage to show in the progress bar.
implements the "\fB--inputbox\fP" or
"\fB--password\fP" option, depending on the value of \fIpassword\fP.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP init
.TP 5
.B const char * \fIinit
is the initial value of the input box, whose length is taken into account
when auto-sizing the width of the dialog box.
.IP password
.TP 5
.B int \fIpassword
if true, causes typed input to be echoed as asterisks.
.RE
.\" ************************************************************************
.IP \fBdialog_helpfile
implements the "\fB--hfile\fP" option.
.RS
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.TP 5
.B const char * \fIfile
is the name of a file containing the text to display.
This function is internally bound to F1 (function key "1"),
passing \fBdialog_vars.help_file\fP as a parameter.
The \fBdialog\fP program sets that variable when the \fB--hfile\fP option
is given.
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.RE
.\" ************************************************************************
.IP \fBdialog_menu
implements the "\fB--menu\fP" or "\fB--inputmenu\fP" option
depending on whether \fIdialog_vars.input_menu\fP is set.
depending on whether \fBdialog_vars.input_menu\fP is set.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP menu_height
.TP 5
.B int \fImenu_height
is the minimum height to reserve for displaying the list.
If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
.IP item_no
.TP 5
.B int \fIitem_no
is the number of rows in \fIitems\fP.
.IP items
.TP 5
.B int \fIitems
is an array of strings which is viewed either as a list of rows
.RS
\fItag item\fR
@ -742,28 +859,35 @@ or
\fItag item help\fR
.RE
.IP
depending on whether \fIdialog_vars.item_help\fP is set.
depending on whether \fBdialog_vars.item_help\fP is set.
.RE
.\" ************************************************************************
.IP \fBdialog_mixedform
implements the "\fB--mixedform\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is adjusted to use the available screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is adjusted to use the available screen size.
.IP form_height
.TP 5
.B int \fIform_height
is the minimum height to reserve for displaying the list.
If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
.IP item_no
.TP 5
.B int \fIitem_no
is the number of rows in \fIitems\fP.
.IP items
.TP 5
.B int \fIitems
is an array of strings which is viewed either as a list of rows
.RS
\fIName NameY NameX Text TextY TextX FLen ILen Ityp\fR
@ -774,27 +898,33 @@ or
\fIName NameY NameX Text TextY TextX FLen ILen Ityp Help\fR
.RE
.IP
depending on whether \fIdialog_vars.item_help\fP is set.
depending on whether \fBdialog_vars.item_help\fP is set.
.RE
.\" ************************************************************************
.IP \fBdialog_mixedgauge
implements the "\fB--mixedgauge\fP" option
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the caption text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP percent
is the percentage to show in the progress bar.
.IP item_no
.TP 5
.B int \fIitem_no
is the number of rows in \fIitems\fP.
.IP items
.TP 5
.B int \fIitems
is an array of strings which is viewed as a list of \fItag\fP and \fIitem\fP values.
The \fItag\fP values are listed, one per row, in the list at the top of
the widget.
@ -832,17 +962,22 @@ Other strings are displayed as is.
implements the "\fB--msgbox\fP" or "\fB--infobox\fP" option
depending on whether \fIpauseopt\fP is set.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP pauseopt
.TP 5
.B int \fIpauseopt
if true, an "OK" button will be shown,
and the dialog will wait for it to complete.
With an "OK" button, it is denoted a "msgbox",
@ -852,35 +987,45 @@ without an "OK" button, it is denoted an "infobox".
.IP \fBdialog_pause
implements the "\fB--pause\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP seconds
.TP 5
.B int \fIseconds
is the timeout to use for the progress bar.
.RE
.\" ************************************************************************
.IP \fBdialog_prgbox
implements the "\fB--prgbox\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
If empty or null, no prompt is shown.
.IP command
.TP 5
.B const char * \fIcommand
is the name of the command to execute.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP pauseopt
.TP 5
.B int \fIpauseopt
if true, an "OK" button will be shown,
and the dialog will wait for it to complete.
.RE
@ -888,15 +1033,19 @@ and the dialog will wait for it to complete.
.IP \fBdialog_progressbox
implements the "\fB--progressbox\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
If empty or null, no prompt is shown.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.RE
@ -905,19 +1054,24 @@ If zero, the height is based on the screen size.
implements the "\fB--tailbox\fP" or "\fB--tailboxbg\fP" option
depending on whether \fIbg_task\fP is set.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP file
.TP 5
.B const char * \fIfile
is the name of the file to display in the dialog.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP bg_task
.TP 5
.B int \fIbg_task
if true,
the window is added to the callback list in \fIdialog_state\fP,
the window is added to the callback list in \fBdialog_state\fP,
and the application will poll for the window to be updated.
Otherwise an "OK" button is added to the window,
and it will be closed when the button is activated.
@ -926,14 +1080,18 @@ and it will be closed when the button is activated.
.IP \fBdialog_textbox
implements the "\fB--textbox\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP file
.TP 5
.B const char * \fIfile
is the name of the file to display in the dialog.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.RE
@ -941,25 +1099,32 @@ If zero, the height is based on the screen size.
.IP \fBdialog_timebox
implements the "\fB--timebox\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP subtitle
.TP 5
.B const char * \fIsubtitle
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP hour
.TP 5
.B int \fIhour
is the initial hour shown.
If the value is negative, the current hour is used.
Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 24.
.IP minute
.TP 5
.B int \fIminute
is the initial minute shown.
If the value is negative, the current minute is used.
Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60.
.IP second
.TP 5
.B int \fIsecond
is the initial second shown.
If the value is negative, the current second is used.
Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60.
@ -968,14 +1133,18 @@ Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60.
.IP \fBdialog_yesno
implements the "\fB--yesno\fP" option.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.RE
@ -989,7 +1158,7 @@ Bowing to longstanding usage, the functions that initialize the
display and end it are named \fIinit_dialog\fP and \fIend_dialog\fP.
.PP
The only non-widget function whose name begins with "\fIdialog_\fP"
is \fIdialog_version\fP, which returns the version number of the
is \fBdialog_version\fP, which returns the version number of the
library as a string.
.
.PP
@ -1079,6 +1248,30 @@ This is the number of rows in the array.
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_allocate_gauge
Allocates a gauge widget.
Use \fBdlg_update_gauge\fP to display the result.
.RS
.TP 5
.B const char * \fItitle
is the title string to display at the top of the widget.
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is adjusted to use the available screen size.
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is adjusted to use the available screen size.
.TP 5
.B int \fIpercent
is the percentage to show in the progress bar.
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_asciibox
returns its parameter transformed to the
corresponding "+" or "-", etc. for the line-drawing characters used in \fB\*p\fP.
@ -1325,7 +1518,7 @@ is the number of \fIitems\fP in the list.
.TP 5
.B dlg_calc_listw
This function is obsolete, provided for library-compatibility.
It is replaced by \fIdlg_calc_list_width\fP.
It is replaced by \fBdlg_calc_list_width\fP.
.RS
.TP 5
.B int \fIitem_no
@ -1541,7 +1734,7 @@ It is terminated by an entry with a null \fIname\fP field.
.TP 5
.B dlg_default_item
This function is obsolete, provided for library-compatibility.
It is replaced by \fIdlg_default_formitem\fP and \fIdlg_default_listitem\fP.
It is replaced by \fBdlg_default_formitem\fP and \fBdlg_default_listitem\fP.
.RS
.TP 5
.B char ** \fIitems
@ -1701,6 +1894,18 @@ is the number of columns (or rows if \fIvertical\fP) allowed for the display.
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_draw_helpline
draw the text in \fBdialog_vars.help_line\fP at the bottom of the given window.
.RS
.TP 5
.B WINDOW * \fIdialog
is the window to modify.
.TP 5
.B bool \fIdecorations
if true, allow room for the scrolling arrows.
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_draw_scrollbar
If \fBdialog_state.use_scrollbar\fP is set,
draw a scrollbar on the right margin of windows holding scrollable data.
@ -1898,7 +2103,8 @@ Quit program killing all \fBtailboxbg\fP widgets.
.B const char * \fIfmt
is the format of the \fBprintf\fP-like message to write.
.TP 5
.
.B ...
.br
are the variables to apply to the \fIfmt\fP format.
.RE
.\" ---------------------------------------------------------------------------
@ -2014,6 +2220,15 @@ is the list to free.
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_free_gauge
Remove the gauge widget from the screen and free its associated memory.
.RS
.TP 5
.B void *\fIobjptr
points to the gauge widget.
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_getc
Read a character from the given window.
Handle repainting here (to simplify
@ -2615,23 +2830,29 @@ applied to the string.
.B dlg_progressbox
implements the "\fB--prgbox\fP" and "\fB--progressbox\fP" options.
.RS
.IP title
.TP 5
.B const char * \fItitle
is the title on the top of the widget.
.IP cprompt
.TP 5
.B const char * \fIcprompt
is the prompt text shown within the widget.
If empty or null, no prompt is shown.
.IP height
.TP 5
.B int \fIheight
is the desired height of the box.
If zero, the height is based on the screen size.
.IP width
.TP 5
.B int \fIwidth
is the desired width of the box.
If zero, the height is based on the screen size.
.IP pauseopt
.TP 5
.B int \fIpauseopt
if true, an "OK" button will be shown,
and the dialog will wait for it to complete.
With an "OK" button, it is denoted a "programbox",
without an "OK" button, it is denoted a "progressbox".
.IP fp
.TP 5
.B FILE * \fIfp
is the file pointer, which may be a pipe or a regular file.
.RE
.\" ---------------------------------------------------------------------------
@ -2865,16 +3086,66 @@ Some of these may be values declared in the DLG_KEYS_ENUM.
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_trace_msg
Write a formatted message to the trace file.
.RS
.TP 5
.B const char * \fIfmt
is the format of the \fBprintf\fP-like message to write.
.TP 5
.B ...
.br
are the variables to apply to the \fIfmt\fP format.
.RE
.IP
Use the DLG_TRACE macro for portability, in case the trace
feature is not compiled into the library.
It uses an extra level of parentheses to work with a variable number of
parameters, e.g.,
.ES
.EX
DLG_TRACE(("this is dialog version %s\\n", dialog_version()));
.EE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_trace_win
If \fBdialog_state.trace\fP is set,
log a printable picture of the given window.
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_trim_string
Change embedded "\\n" substrings to '\\n' characters and tabs to single spaces.
If there are no "\\n"s, the function strips all extra spaces, for justification.
If it has "\\n"'s, the function preserves extra spaces.
If \fBdialog_vars.cr_wrap\fP is set, the function preserves '\\n's.
The \fBdialog\fP program uses this in each widget to adjust the
message string,
which may contain the newline character (referred to as '\\n')
and/or the special substring "\\n"
(which can be translated into a newline character).
.IP
There are several optional features:
.RS
.bP
Unless \fBdialog_vars.no_nl_expand\fP is set,
.RS
.bP
If it has "\\n" substrings,
the function preserves extra spaces.
For instance, spaces following a newline (substring or character)
are preserved to use as an indentation.
.bP
The function changes embedded "\\n" substrings to '\\n' characters.
.RE
.bP
If \fBdialog_vars.no_nl_expand\fP is not set,
or if there are no "\\n" substrings,
this function strips all extra spaces to simplify justification.
.bP
If \fBdialog_vars.cr_wrap\fP is set,
the function preserves '\\n' newline characters.
Otherwise, each '\\n' newline character is converted to a space.
.bP
Unless \fBdialog_vars.nocollapse\fP is set,
each tab character is converted to a space,
and sequences of blanks (space or tab) are reduced to a single space.
.RE
.RS
.TP 5
.B char * \fIsrc
@ -2891,6 +3162,18 @@ is the window from which to remove bindings
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_update_gauge
Update a gauge widget to show a different percentage value.
.RS
.TP 5
.B void *\fIobjptr
points to the gauge object to update.
.TP 5
.B int \fIpercent
is the new percentage value to display.
.RE
.\" ---------------------------------------------------------------------------
.TP 5
.B dlg_yes_buttoncode
Map the given button index for \fBdlg_yes_labels\fP into \fB\*p\fP's exit-code.
.RS

View File

@ -1,5 +1,5 @@
/*
* $Id: dialog.c,v 1.186 2011/03/02 09:58:29 tom Exp $
* $Id: dialog.c,v 1.193 2011/06/29 09:10:56 tom Exp $
*
* cdialog - Display simple dialog boxes from shell scripts
*
@ -71,7 +71,9 @@ typedef enum {
,o_gauge
,o_help
,o_help_button
,o_help_file
,o_help_label
,o_help_line
,o_help_status
,o_icon
,o_ignore
@ -96,6 +98,7 @@ typedef enum {
,o_no_label
,o_no_lines
,o_no_mouse
,o_no_nl_expand
,o_no_shadow
,o_nocancel
,o_noitem
@ -137,6 +140,7 @@ typedef enum {
,o_title
,o_trim
,o_under_mouse
,o_version
,o_visit_items
,o_wmclass
,o_yes_label
@ -215,6 +219,8 @@ static const Options options[] = {
{ "help-button", o_help_button, 1, "" },
{ "help-label", o_help_label, 1, "<str>" },
{ "help-status", o_help_status, 1, "" },
{ "hfile", o_help_file, 1, "<str>" },
{ "hline", o_help_line, 1, "<str>" },
{ "icon", o_icon, 1, NULL },
{ "ignore", o_ignore, 1, "" },
{ "infobox", o_infobox, 2, "<text> <height> <width>" },
@ -239,6 +245,7 @@ static const Options options[] = {
{ "no-label", o_no_label, 1, "<str>" },
{ "no-lines", o_no_lines, 1, "" },
{ "no-mouse", o_no_mouse, 1, "" },
{ "no-nl-expand", o_no_nl_expand, 1, "" },
{ "no-ok", o_nook, 1, "" },
{ "no-shadow", o_no_shadow, 1, "" },
{ "nocancel", o_nocancel, 1, NULL }, /* see --no-cancel */
@ -281,7 +288,7 @@ static const Options options[] = {
{ "title", o_title, 1, "<title>" },
{ "trim", o_trim, 1, "" },
{ "under-mouse", o_under_mouse, 1, NULL },
{ "version", o_print_version, 5, "" },
{ "version", o_version, 5, "" },
{ "visit-items", o_visit_items, 1, "" },
{ "wmclass", o_wmclass, 1, NULL },
{ "yes-label", o_yes_label, 1, "<str>" },
@ -872,6 +879,7 @@ call_mixed_gauge(CALLARGS)
}
#endif
#ifdef HAVE_DLG_GAUGE
static int
call_prgbox(CALLARGS)
{
@ -891,6 +899,7 @@ call_prgbox(CALLARGS)
numeric_arg(av, 2),
numeric_arg(av, 3), TRUE));
}
#endif
#ifdef HAVE_DLG_GAUGE
static int
@ -1088,6 +1097,15 @@ compare_opts(const void *a, const void *b)
return strcmp((*p)->name, (*q)->name);
}
/*
* Print program's version.
*/
static void
PrintVersion(FILE *fp)
{
fprintf(fp, "Version: %s\n", dialog_version());
}
/*
* Print program help-message
*/
@ -1122,6 +1140,9 @@ Help(void)
size_t j, k;
const Options **opts;
end_dialog();
dialog_state.output = stdout;
opts = dlg_calloc(const Options *, limit);
assert_ptr(opts, "Help");
for (j = 0; j < limit; ++j) {
@ -1191,6 +1212,9 @@ process_common_options(int argc, char **argv, int offset, bool output)
case o_cr_wrap:
dialog_vars.cr_wrap = TRUE;
break;
case o_no_nl_expand:
dialog_vars.no_nl_expand = TRUE;
break;
case o_no_collapse:
dialog_vars.nocollapse = TRUE;
break;
@ -1236,6 +1260,12 @@ process_common_options(int argc, char **argv, int offset, bool output)
case o_item_help:
dialog_vars.item_help = TRUE;
break;
case o_help_line:
dialog_vars.help_line = optionString(argv, &offset);
break;
case o_help_file:
dialog_vars.help_file = optionString(argv, &offset);
break;
case o_help_button:
dialog_vars.help_button = TRUE;
break;
@ -1274,7 +1304,7 @@ process_common_options(int argc, char **argv, int offset, bool output)
break;
case o_print_version:
if (output) {
fprintf(stdout, "Version: %s\n", dialog_version());
PrintVersion(dialog_state.output);
}
break;
case o_separator:
@ -1356,6 +1386,7 @@ process_common_options(int argc, char **argv, int offset, bool output)
break;
case o_no_mouse:
dialog_state.no_mouse = TRUE;
mouse_close();
break;
case o_noitem:
case o_fullbutton:
@ -1474,6 +1505,9 @@ main(int argc, char *argv[])
* that. We can only write to one of them. If --stdout is used, that
* can interfere with initializing the curses library, so we want to
* know explicitly if it is used.
*
* Also, look for any --version or --help message, processing those
* immediately.
*/
while (offset < argc) {
int base = offset;
@ -1497,6 +1531,14 @@ main(int argc, char *argv[])
case o_keep_tite:
keep_tite = TRUE;
break;
case o_version:
dialog_state.output = stdout;
PrintVersion(dialog_state.output);
exit(DLG_EXIT_OK);
break;
case o_help:
Help();
break;
default:
++offset;
continue;
@ -1512,7 +1554,11 @@ main(int argc, char *argv[])
offset = 1;
init_result(my_buffer);
if (argc == 2) { /* if we don't want clear screen */
/*
* Dialog's output may be redirected (see above). Handle the special
* case of options that only report information without interaction.
*/
if (argc == 2) {
switch (lookupOption(argv[1], 7)) {
case o_print_maxsize:
(void) initscr();
@ -1521,7 +1567,7 @@ main(int argc, char *argv[])
fprintf(dialog_state.output, "MaxSize: %d, %d\n", SLINES, SCOLS);
break;
case o_print_version:
fprintf(stdout, "Version: %s\n", dialog_version());
PrintVersion(dialog_state.output);
break;
case o_clear:
initscr();
@ -1531,8 +1577,6 @@ main(int argc, char *argv[])
case o_ignore:
break;
default:
case o_help:
dialog_state.output = stdout;
Help();
break;
}
@ -1621,6 +1665,8 @@ main(int argc, char *argv[])
case o_unknown:
case o_title:
case o_backtitle:
case o_help_line:
case o_help_file:
break;
default:
if (argv[j] != 0) {

View File

@ -1,5 +1,5 @@
/*
* $Id: dialog.h,v 1.223 2011/03/02 10:04:09 tom Exp $
* $Id: dialog.h,v 1.231 2011/06/29 09:51:00 tom Exp $
*
* dialog.h -- common declarations for all dialog modules
*
@ -44,7 +44,10 @@
#include <signal.h> /* fork() etc. */
#include <math.h> /* sqrt() */
#undef ERR /* header conflict with Solaris xpg4 */
/* header conflict with Solaris xpg4 versus <sys/regset.h> */
#if defined(ERR) && (ERR == 13)
#undef ERR
#endif
#if defined(HAVE_NCURSESW_NCURSES_H)
#include <ncursesw/ncurses.h>
@ -140,6 +143,7 @@
#define DLG_CTRL(n) ((n) & 0x1f) /* CTRL is preferred, but conflicts */
#define CHR_HELP DLG_CTRL('E')
#define CHR_BACKSPACE DLG_CTRL('H')
#define CHR_REPAINT DLG_CTRL('L')
#define CHR_KILL DLG_CTRL('U')
@ -476,6 +480,11 @@ typedef struct {
/* 1.1-20100118 */
char *date_format; /* option "--date-format" */
char *time_format; /* option "--time-format" */
/* 1.1-20110629 */
char *help_line; /* option "--hline" */
char *help_file; /* option "--hfile" */
bool in_helpfile; /* flag to prevent recursion in --hfile */
bool no_nl_expand; /* option "--no-nl-expand" */
} DIALOG_VARS;
#define USE_ITEM_HELP(s) (dialog_vars.item_help && (s) != 0)
@ -530,6 +539,7 @@ extern int dialog_editbox(const char * /*title*/, const char * /*file*/, int /*h
extern int dialog_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/);
extern int dialog_fselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/);
extern int dialog_gauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/);
extern int dialog_helpfile(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);
extern int dialog_inputbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, const char * /*init*/, const int /*password*/);
extern int dialog_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, char ** /*items*/);
extern int dialog_mixedform(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/);
@ -584,6 +594,7 @@ extern int dlg_eat_argv(int * /* argcp */, char *** /* argvp */, int /* start */
/* arrows.c */
extern void dlg_draw_arrows(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/);
extern void dlg_draw_arrows2(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/);
extern void dlg_draw_helpline(WINDOW * /*dialog*/, bool /*decorations*/);
extern void dlg_draw_scrollbar(WINDOW * /*dialog*/, long /* first_data */, long /* this_data */, long /* next_data */, long /* total_data */, int /* left */, int /* right */, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/);
/* buttons.c */
@ -619,6 +630,11 @@ extern int dlg_default_formitem(DIALOG_FORMITEM * /*items*/);
extern int dlg_ordinate(const char * /*s*/);
extern void dlg_free_formitems(DIALOG_FORMITEM * /*items*/);
/* guage.c */
extern void * dlg_allocate_gauge(const char * /* title */, const char * /* cprompt */, int /* height */, int /* width */, int /* percent */);
extern void dlg_free_gauge(void * /* objptr */);
extern void dlg_update_gauge(void * /* objptr */, int /* percent */);
/* inputstr.c */
extern bool dlg_edit_string(char * /*string*/, int * /*offset*/, int /*key*/, int /*fkey*/, bool /*force*/);
extern const int * dlg_index_columns(const char * /*string*/);
@ -739,6 +755,12 @@ extern void dlg_trace(const char * /*fname*/);
extern void dlg_move_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
#endif
/*
* Normally "enter" means "ok". Use this macro to handle the explicit
* check for DLGK_ENTER:
*/
#define dlg_enter_buttoncode(code) (dialog_vars.nook ? DLG_EXIT_OK : dlg_ok_buttoncode(code))
/*
* The following stuff is needed for mouse support
*/

View File

@ -1,9 +1,9 @@
/*
* $Id: dlg_keys.h,v 1.24 2010/01/19 00:57:36 tom Exp $
* $Id: dlg_keys.h,v 1.26 2011/06/21 22:09:22 tom Exp $
*
* dlg_keys.h -- runtime binding support for dialog
* dlg_keys.h -- runtime binding support for dialog
*
* Copyright 2005-2007,2010 Thomas E. Dickey
* Copyright 2005-2010,2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@ -89,12 +89,18 @@ typedef enum {
DLGK_BEGIN,
DLGK_FINAL,
DLGK_SELECT,
DLGK_HELPFILE,
DLGK_TRACE
} DLG_KEYS_ENUM;
#define is_DLGK_MOUSE(code) ((code) >= M_EVENT)
#define DLGK_MOUSE(code) ((code) + M_EVENT)
#define HELPKEY_BINDINGS \
DLG_KEYS_DATA( DLGK_HELPFILE, CHR_HELP ), \
DLG_KEYS_DATA( DLGK_HELPFILE, KEY_F(1) ), \
DLG_KEYS_DATA( DLGK_HELPFILE, KEY_HELP )
#define ENTERKEY_BINDINGS \
DLG_KEYS_DATA( DLGK_ENTER, '\n' ), \
DLG_KEYS_DATA( DLGK_ENTER, '\r' ), \

View File

@ -1,9 +1,9 @@
/*
* $Id: editbox.c,v 1.54 2010/04/28 21:02:01 tom Exp $
* $Id: editbox.c,v 1.55 2011/06/21 00:10:46 tom Exp $
*
* editbox.c -- implements the edit box
*
* Copyright 2007-2009,2010 Thomas E. Dickey
* Copyright 2007-2010,2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@ -312,12 +312,14 @@ dlg_editbox(const char *title,
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
NAVIGATE_BINDINGS,
END_KEYS_BINDING
};
static DLG_KEYS_BINDING binding2[] = {
INPUTSTR_BINDINGS,
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
NAVIGATE_BINDINGS,
END_KEYS_BINDING

View File

@ -1,9 +1,9 @@
/*
* $Id: formbox.c,v 1.71 2010/02/24 10:45:57 Samuel.Martin.Moro Exp $
* $Id: formbox.c,v 1.73 2011/06/29 09:48:08 tom Exp $
*
* formbox.c -- implements the form (i.e, some pairs label/editbox)
*
* Copyright 2003-2009,2010 Thomas E. Dickey
* Copyright 2003-2010,2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@ -433,12 +433,14 @@ dlg_form(const char *title,
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
NAVIGATE_BINDINGS,
END_KEYS_BINDING
};
static DLG_KEYS_BINDING binding2[] = {
INPUTSTR_BINDINGS,
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
NAVIGATE_BINDINGS,
END_KEYS_BINDING
@ -633,7 +635,7 @@ dlg_form(const char *title,
case DLGK_ENTER:
dlg_del_window(dialog);
result = (state >= 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
result = (state >= 0) ? dlg_enter_buttoncode(state) : DLG_EXIT_OK;
continue;
case DLGK_GRID_LEFT:

View File

@ -1,5 +1,5 @@
/*
* $Id: fselect.c,v 1.76 2011/01/16 22:20:16 tom Exp $
* $Id: fselect.c,v 1.78 2011/06/29 09:48:21 tom Exp $
*
* fselect.c -- implements the file-selector box
*
@ -532,12 +532,14 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
NAVIGATE_BINDINGS,
END_KEYS_BINDING
};
static DLG_KEYS_BINDING binding2[] = {
INPUTSTR_BINDINGS,
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
NAVIGATE_BINDINGS,
END_KEYS_BINDING
@ -795,7 +797,7 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
}
/* FALLTHRU */
case DLGK_ENTER:
result = (state > 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
result = (state > 0) ? dlg_enter_buttoncode(state) : DLG_EXIT_OK;
continue;
#ifdef KEY_RESIZE
case KEY_RESIZE:

220
guage.c
View File

@ -1,5 +1,5 @@
/*
* $Id: guage.c,v 1.52 2011/01/17 10:39:28 tom Exp $
* $Id: guage.c,v 1.60 2011/06/27 00:52:28 tom Exp $
*
* guage.c -- implements the gauge dialog
*
@ -35,8 +35,9 @@
#define isMarker(buf) !strncmp(buf, "XXX", (size_t) 3)
typedef struct {
DIALOG_CALLBACK obj;
typedef struct _my_obj {
DIALOG_CALLBACK obj; /* has to be first in struct */
struct _my_obj *next;
WINDOW *text;
const char *title;
char *prompt;
@ -47,6 +48,43 @@ typedef struct {
char line[MAX_LEN + 1];
} MY_OBJ;
static MY_OBJ *all_objects;
static int
valid(MY_OBJ * obj)
{
MY_OBJ *list = all_objects;
int result = 0;
while (list != 0) {
if (list == obj) {
result = 1;
break;
}
list = list->next;
}
return result;
}
static void
delink(MY_OBJ * obj)
{
MY_OBJ *p = all_objects;
MY_OBJ *q = 0;
while (p != 0) {
if (p == obj) {
if (q != 0) {
q->next = p->next;
} else {
all_objects = p->next;
}
break;
}
q = p;
p = p->next;
}
}
static int
read_data(char *buffer, FILE *fp)
{
@ -55,6 +93,7 @@ read_data(char *buffer, FILE *fp)
if (feof(fp)) {
result = 0;
} else if (fgets(buffer, MY_LEN, fp) != 0) {
DLG_TRACE(("read_data:%s", buffer));
dlg_trim_string(buffer);
result = 1;
} else {
@ -88,6 +127,7 @@ repaint_text(MY_OBJ * obj)
dlg_draw_title(dialog, obj->title);
wattrset(dialog, dialog_attr);
dlg_draw_helpline(dialog, FALSE);
dlg_print_autowrap(dialog, obj->prompt, obj->height, obj->width);
dlg_draw_box(dialog,
@ -179,6 +219,7 @@ handle_input(DIALOG_CALLBACK * cb)
} else {
if (feof(dialog_state.pipe_input) ||
(ferror(dialog_state.pipe_input) && errno != EINTR)) {
delink(obj);
dlg_remove_callback(cb);
}
}
@ -202,7 +243,8 @@ handle_my_getc(DIALOG_CALLBACK * cb, int ch, int fkey, int *result)
if (cb != 0) {
if (!fkey && (ch == ERR)) {
(void) handle_input(cb);
status = (cb->input != 0);
/* cb might be freed in handle_input */
status = (valid((MY_OBJ *) cb) && (cb->input != 0));
}
} else {
status = FALSE;
@ -215,9 +257,85 @@ my_cleanup(DIALOG_CALLBACK * cb)
{
MY_OBJ *obj = (MY_OBJ *) cb;
if (obj != 0) {
if (obj->prompt != obj->prompt_buf)
if (valid(obj)) {
if (obj->prompt != obj->prompt_buf) {
free(obj->prompt);
obj->prompt = obj->prompt_buf;
}
delink(obj);
}
}
void
dlg_update_gauge(void *objptr, int percent)
{
MY_OBJ *obj = (MY_OBJ *) objptr;
curs_set(0);
obj->percent = percent;
repaint_text(obj);
}
/*
* Allocates a new object and fills it as per the arguments
*/
void *
dlg_allocate_gauge(const char *title,
const char *cprompt,
int height,
int width,
int percent)
{
int x, y;
char *prompt = dlg_strclone(cprompt);
WINDOW *dialog;
MY_OBJ *obj = 0;
dlg_tab_correct_str(prompt);
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MIN_WIDE);
dlg_print_size(height, width);
dlg_ctl_size(height, width);
/* center dialog box on screen */
x = dlg_box_x_ordinate(width);
y = dlg_box_y_ordinate(height);
dialog = dlg_new_window(height, width, y, x);
obj = dlg_calloc(MY_OBJ, 1);
assert_ptr(obj, "dialog_gauge");
obj->obj.input = dialog_state.pipe_input;
obj->obj.win = dialog;
obj->obj.keep_win = TRUE;
obj->obj.bg_task = TRUE;
obj->obj.handle_getc = handle_my_getc;
obj->obj.handle_input = handle_input;
obj->title = title;
obj->prompt = prompt;
obj->percent = percent;
obj->height = height;
obj->width = width;
obj->next = all_objects;
all_objects = obj;
return (void *) obj;
}
void
dlg_free_gauge(void *objptr)
{
MY_OBJ *obj = (MY_OBJ *) objptr;
curs_set(1);
if (valid(obj)) {
delink(obj);
obj->obj.keep_win = FALSE;
dlg_remove_callback(&(obj->obj));
free(obj);
}
}
@ -236,80 +354,46 @@ dialog_gauge(const char *title,
int width,
int percent)
{
#ifdef KEY_RESIZE
int old_height = height;
int old_width = width;
#endif
int fkey;
int ch, result;
int x, y;
char *prompt = dlg_strclone(cprompt);
WINDOW *dialog;
MY_OBJ *obj = 0;
void *objptr = dlg_allocate_gauge(title, cprompt, height, width, percent);
MY_OBJ *obj = (MY_OBJ *) objptr;
curs_set(0);
dlg_tab_correct_str(prompt);
#ifdef KEY_RESIZE
retry:
#endif
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MIN_WIDE);
dlg_print_size(height, width);
dlg_ctl_size(height, width);
/* center dialog box on screen */
x = dlg_box_x_ordinate(width);
y = dlg_box_y_ordinate(height);
dialog = dlg_new_window(height, width, y, x);
if (obj == 0) {
MY_OBJ **objref;
obj = dlg_calloc(MY_OBJ, 1);
assert_ptr(obj, "dialog_gauge");
objref = &obj;
obj->obj.input = dialog_state.pipe_input;
obj->obj.win = dialog;
obj->obj.keep_win = TRUE;
obj->obj.bg_task = TRUE;
obj->obj.handle_getc = handle_my_getc;
obj->obj.handle_input = handle_input;
obj->title = title;
obj->prompt = prompt;
obj->percent = percent;
obj->height = height;
obj->width = width;
dlg_add_callback_ref((DIALOG_CALLBACK **) objref, my_cleanup);
} else {
obj->obj.win = dialog;
}
repaint_text(obj);
dlg_add_callback_ref((DIALOG_CALLBACK **) & obj, my_cleanup);
dlg_update_gauge(obj, percent);
do {
ch = dlg_getc(dialog, &fkey);
ch = dlg_getc(obj->obj.win, &fkey);
#ifdef KEY_RESIZE
if (fkey && ch == KEY_RESIZE) {
/* reset data */
height = old_height;
width = old_width;
/* repaint */
dlg_clear();
dlg_del_window(dialog);
refresh();
MY_OBJ *oldobj = obj;
dlg_mouse_free_regions();
goto retry;
obj = dlg_allocate_gauge(title,
cprompt,
height,
width,
oldobj->percent);
/* avoid breaking new window in dlg_remove_callback */
oldobj->obj.caller = 0;
oldobj->obj.input = 0;
oldobj->obj.keep_win = FALSE;
/* remove the old version of the gauge */
dlg_clear();
dlg_remove_callback(&(oldobj->obj));
refresh();
dlg_add_callback_ref((DIALOG_CALLBACK **) & obj, my_cleanup);
dlg_update_gauge(obj, obj->percent);
}
#endif
}
while (handle_my_getc(&(obj->obj), ch, fkey, &result));
while (valid(obj) && handle_my_getc(&(obj->obj), ch, fkey, &result));
curs_set(1);
dlg_del_window(dialog);
dlg_free_gauge(obj);
return (DLG_EXIT_OK);
}

43
help.c Normal file
View File

@ -0,0 +1,43 @@
/*
* $Id: help.c,v 1.2 2011/06/25 00:27:16 tom Exp $
*
* help.c -- implements the help dialog
*
* Copyright 2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to
* Free Software Foundation, Inc.
* 51 Franklin St., Fifth Floor
* Boston, MA 02110, USA.
*/
#include <dialog.h>
/*
* Display a help-file as a textbox widget.
*/
int
dialog_helpfile(const char *title,
const char *file,
int height,
int width)
{
int result = DLG_EXIT_ERROR;
if (!dialog_vars.in_helpfile && file != 0 && *file != '\0') {
dialog_vars.in_helpfile = TRUE;
result = dialog_textbox(title, file, height, width);
dialog_vars.in_helpfile = FALSE;
}
return (result);
}

View File

@ -1,9 +1,9 @@
/*
* $Id: inputbox.c,v 1.64 2010/01/19 01:03:39 tom Exp $
* $Id: inputbox.c,v 1.67 2011/06/29 09:48:34 tom Exp $
*
* inputbox.c -- implements the input box
* inputbox.c -- implements the input box
*
* Copyright 2000-2009,2010 Thomas E. Dickey
* Copyright 2000-2010,2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@ -46,12 +46,14 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width,
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
NAVIGATE_BINDINGS,
END_KEYS_BINDING
};
static DLG_KEYS_BINDING binding2[] = {
INPUTSTR_BINDINGS,
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
NAVIGATE_BINDINGS,
END_KEYS_BINDING
@ -119,6 +121,7 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width,
dlg_draw_title(dialog, title);
wattrset(dialog, dialog_attr);
dlg_draw_helpline(dialog, FALSE);
dlg_print_autowrap(dialog, prompt, height, width);
/* Draw the input field box */
@ -202,7 +205,7 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width,
case ' ': /* FIXME: conflict with inputstr.c */
case DLGK_ENTER:
dlg_del_window(dialog);
result = (state >= 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
result = (state >= 0) ? dlg_enter_buttoncode(state) : DLG_EXIT_OK;
break;
#ifdef KEY_RESIZE
case KEY_RESIZE:

View File

@ -1,4 +1,4 @@
# $Id: makefile.in,v 1.78 2011/03/02 09:57:24 tom Exp $
# $Id: makefile.in,v 1.79 2011/06/25 00:27:56 tom Exp $
# template makefile for DIALOG
##############################################################################
# Copyright (c) 1999-2010,2011 Thomas E. Dickey #
@ -134,6 +134,7 @@ OBJECTS = $(EXTRAOBJS) \
columns$o \
dlg_keys$o \
editbox$o \
help$o \
inputbox$o \
inputstr$o \
menubox$o \

View File

@ -1,5 +1,5 @@
/*
* $Id: menubox.c,v 1.120 2011/01/19 00:27:53 tom Exp $
* $Id: menubox.c,v 1.122 2011/06/29 09:48:46 tom Exp $
*
* menubox.c -- implements the menu box
*
@ -291,6 +291,7 @@ dlg_menu(const char *title,
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_FIELD_NEXT, ' ' ),
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ),
@ -312,6 +313,7 @@ dlg_menu(const char *title,
};
static DLG_KEYS_BINDING binding2[] = {
INPUTSTR_BINDINGS,
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
END_KEYS_BINDING
};
@ -685,7 +687,7 @@ dlg_menu(const char *title,
FALSE, width);
break;
case DLGK_ENTER:
result = dlg_ok_buttoncode(button);
result = dlg_enter_buttoncode(button);
/*
* If dlg_menu() is called from dialog_menu(), we want to

View File

@ -1,5 +1,5 @@
/*
* $Id: mixedgauge.c,v 1.23 2011/01/19 00:27:53 tom Exp $
* $Id: mixedgauge.c,v 1.24 2011/06/27 08:16:38 tom Exp $
*
* mixedgauge.c -- implements the mixedgauge dialog
*
@ -331,6 +331,7 @@ dlg_begin_mixedgauge(DIALOG_MIXEDGAUGE * dlg,
dialog_attr, border_attr);
dlg_draw_title(dlg->dialog, dlg->title);
dlg_draw_helpline(dlg->dialog, FALSE);
if ((dlg->prompt != 0 && *(dlg->prompt) != 0)
&& wmove(dlg->dialog, dlg->item_no, 0) != ERR) {

View File

@ -1,9 +1,9 @@
/*
* $Id: msgbox.c,v 1.64 2010/01/15 10:50:17 tom Exp $
* $Id: msgbox.c,v 1.66 2011/06/27 08:36:28 tom Exp $
*
* msgbox.c -- implements the message box and info box
*
* Copyright 2000-2009,2010 Thomas E. Dickey
* Copyright 2000-2010,2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@ -37,6 +37,7 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width,
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
SCROLLKEY_BINDINGS,
@ -103,6 +104,7 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width,
dlg_draw_bottom_box(dialog);
mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n');
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
dlg_draw_helpline(dialog, FALSE);
while (result == DLG_EXIT_UNKNOWN) {
if (show) {
@ -172,6 +174,7 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width,
}
} else {
dlg_print_scrolled(dialog, prompt, offset, page, width, pauseopt);
dlg_draw_helpline(dialog, FALSE);
wrefresh(dialog);
result = DLG_EXIT_OK;
}

View File

@ -1,3 +1,15 @@
cdialog (20110707) unstable; urgency=high
* fix a regression in dlg_getc() from 20110630 changes.
-- Thomas E. Dickey <dickey@invisible-island.net> Thu, 07 Jul 2011 18:10:47 -0400
cdialog (20110630) unstable; urgency=high
* various bug-fixes reported in FreeBSD.
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 13 Jun 2011 05:44:17 -0400
cdialog (20110302) unstable; urgency=high
* Add --prgbox and --progressbox

View File

@ -3,12 +3,12 @@ Maintainer: Thomas E. Dickey <dickey@invisible-island.net>
Section: misc
Priority: optional
Standards-Version: 3.8.4
Build-Depends: debhelper (>= 5)
Build-Depends: debhelper (>= 5), libncursesw5-dev (>= 5.3), groff-base
Homepage: http://invisible-island.net/dialog/
Package: cdialog
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Depends: libncursesw5 (>= 5.3)
Description: dialog - display dialog boxes from shell scripts
Dialog is a program that will let you to present a variety of questions
or display messages using dialog boxes from a shell script. These

View File

@ -1,9 +1,9 @@
Summary: dialog - display dialog boxes from shell scripts
%define AppProgram dialog
%define AppVersion 1.1
%define AppRelease 20110302
%define AppRelease 20110707
%define ActualProg c%{AppProgram}
# $XTermId: dialog.spec,v 1.16 2011/03/02 10:08:16 tom Exp $
# $XTermId: dialog.spec,v 1.24 2011/07/07 22:10:02 tom Exp $
Name: %{ActualProg}
Version: %{AppVersion}
Release: %{AppRelease}

View File

@ -1,5 +1,5 @@
/*
* $Id: pause.c,v 1.26 2011/01/18 10:16:33 tom Exp $
* $Id: pause.c,v 1.29 2011/06/29 09:48:53 tom Exp $
*
* pause.c -- implements the pause dialog
*
@ -53,6 +53,7 @@ dialog_pause(const char *title,
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ),
@ -124,6 +125,7 @@ dialog_pause(const char *title,
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
dlg_draw_title(dialog, title);
dlg_draw_helpline(dialog, FALSE);
wattrset(dialog, dialog_attr);
dlg_print_autowrap(dialog, prompt, height, width);
@ -215,7 +217,7 @@ dialog_pause(const char *title,
FALSE, width);
break;
case DLGK_ENTER:
result = dlg_ok_buttoncode(button);
result = dlg_enter_buttoncode(button);
break;
case DLGK_MOUSE(0):
result = DLG_EXIT_OK;

111
po/sk.po Normal file
View File

@ -0,0 +1,111 @@
# Dialog
# Copyright 2003-2007,2008 # Thomas Dickey
# This file is distributed under the same license as the dialog package.
# Marián Čavojský <preklad@cavo.sk>, 2011
#
msgid ""
msgstr ""
"Project-Id-Version: dialog 1.1.20080819\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
"PO-Revision-Date: 2011-03-09 09:50+0100\n"
"Last-Translator: Marián Čavojský <preklad@cavo.sk>\n"
"Language-Team: Slovak <sk-i18n@lists.linux.sk>\n"
"Language: sk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: buttons.c:385
msgid "Yes"
msgstr "Áno"
#: buttons.c:393
msgid "No"
msgstr "Nie"
#: buttons.c:401
msgid "OK"
msgstr "OK"
#: buttons.c:409
msgid "Cancel"
msgstr "Zrušiť"
#: buttons.c:417
msgid "EXIT"
msgstr "VÝCHOD"
#: buttons.c:425
msgid "Extra"
msgstr "Extra"
#: buttons.c:433
msgid "Help"
msgstr "Pomoc"
#. Headline "Month"
#: calendar.c:273
msgid "Month"
msgstr "Mesiac"
#. Headline "Year"
#: calendar.c:293
msgid "Year"
msgstr "Rok"
#: dialog.c:741
msgid "Rename"
msgstr "Premenovať"
#: fselect.c:550
msgid "Directories"
msgstr "Adresáre"
#: fselect.c:551
msgid "Files"
msgstr "Súbory"
#: mixedgauge.c:58
msgid "Succeeded"
msgstr "Vporiadku"
#: mixedgauge.c:61
msgid "Failed"
msgstr "S chybou"
#: mixedgauge.c:64
msgid "Passed"
msgstr "Prešlo"
#: mixedgauge.c:67
msgid "Completed"
msgstr "Skompletované"
#: mixedgauge.c:70
msgid "Checked"
msgstr "Skontrolované"
#: mixedgauge.c:73
msgid "Done"
msgstr "Dokončené"
#: mixedgauge.c:76
msgid "Skipped"
msgstr "Preskočené"
#: mixedgauge.c:79
msgid "In Progress"
msgstr "Spracováva"
#: mixedgauge.c:85
msgid "N/A"
msgstr "N/A"
#: mixedgauge.c:193
msgid "Overall Progress"
msgstr "Celkový pokrok"
#: textbox.c:489
msgid "Search"
msgstr "Vyhľadať"

View File

@ -1,14 +1,13 @@
/*
* $Id: prgbox.c,v 1.6 2011/03/02 09:59:26 tom Exp $
* $Id: prgbox.c,v 1.7 2011/06/30 20:44:13 tom Exp $
*
* prgbox.c -- implements the prg box
*
* Copyright 2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
* it under the terms of the GNU Lesser General Public License, version 2.1
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of

View File

@ -1,5 +1,5 @@
/*
* $Id: progressbox.c,v 1.11 2011/03/02 01:10:08 tom Exp $
* $Id: progressbox.c,v 1.13 2011/06/27 08:18:20 tom Exp $
*
* progressbox.c -- implements the progress box
*
@ -109,6 +109,7 @@ pause_for_ok(WINDOW *dialog, int height, int width)
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
END_KEYS_BINDING
@ -189,6 +190,7 @@ dlg_progressbox(const char *title,
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
dlg_draw_title(dialog, title);
dlg_draw_helpline(dialog, FALSE);
if (*prompt != '\0') {
int y2, x2;

15
rc.c
View File

@ -1,9 +1,9 @@
/*
* $Id: rc.c,v 1.45 2010/01/18 10:28:16 tom Exp $
* $Id: rc.c,v 1.47 2011/06/20 22:30:04 tom Exp $
*
* rc.c -- routines for processing the configuration file
*
* Copyright 2000-2008,2010 Thomas E. Dickey
* Copyright 2000-2010,2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@ -433,9 +433,7 @@ dlg_create_rc(const char *filename)
dlg_color_table[i].hilite));
}
#endif /* HAVE_COLOR */
#if 1
dlg_dump_keys(rc_file);
#endif
(void) fclose(rc_file);
}
@ -455,9 +453,7 @@ dlg_parse_rc(void)
char *tempptr;
int result = 0;
FILE *rc_file = 0;
#if 1
char *params;
#endif
/*
* At startup, dialog determines the settings to use as follows:
@ -486,20 +482,21 @@ dlg_parse_rc(void)
sprintf(str, "%s%s", tempptr, DIALOGRC);
else
sprintf(str, "%s/%s", tempptr, DIALOGRC);
rc_file = fopen(str, "rt");
rc_file = fopen(tempptr = str, "rt");
}
}
if (rc_file == NULL) { /* step (b) failed? */
/* try step (c) */
strcpy(str, GLOBALRC);
if ((rc_file = fopen(str, "rt")) == NULL)
if ((rc_file = fopen(tempptr = str, "rt")) == NULL)
return 0; /* step (c) failed, use default values */
}
DLG_TRACE(("opened rc file \"%s\"\n", tempptr));
/* Scan each line and set variables */
while ((result == 0) && (fgets(str, MAX_LEN, rc_file) != NULL)) {
dlg_trace_msg("rc:%s\n", str);
DLG_TRACE(("rc:%s", str));
if (*str == '\0' || lastch(str) != '\n') {
/* ignore rest of file if line too long */
fprintf(stderr, "\nParse error: line %d of configuration"

847
samples/valgrind.log Normal file
View File

@ -0,0 +1,847 @@
==23273== Memcheck, a memory error detector.
==23273== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==23273== Using LibVEX rev 1854, a library for dynamic binary translation.
==23273== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==23273== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation framework.
==23273== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==23273==
--23273-- Command line
--23273-- /usr/build/dialog/dialog-1.1-20110707/dialog
--23273-- --title
--23273-- YES/NO BOX
--23273-- --clear
--23273-- --yesno
--23273-- Hi, this is a yes/no dialog box. You can use this to ask questions that have an answer of either yes or no. BTW, do you notice that long lines will be automatically wrapped around so that they can fit in the box? You can also control line breaking explicitly by inserting 'backslash n' at any place you like, but in this case, auto wrap around will be disabled and you will have to control line breaking yourself.
--23273-- 15
--23273-- 61
--23273-- Startup, with flags:
--23273-- --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp
--23273-- -v
--23273-- --num-callers=10
--23273-- --error-limit=no
--23273-- --show-reachable=yes
--23273-- --leak-resolution=high
--23273-- --leak-check=yes
--23273-- --show-reachable=yes
--23273-- --log-fd=2
--23273-- Contents of /proc/version:
--23273-- Linux version 2.6.26-2-686 (Debian 2.6.26-26lenny3) (dannf@debian.org) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Sat Jun 11 14:54:10 UTC 2011
--23273-- Arch and hwcaps: X86, x86-sse1-sse2
--23273-- Page sizes: currently 4096, max supported 4096
--23273-- Valgrind library directory: /usr/lib/valgrind
--23273-- Reading syms from /lib/ld-2.7.so (0x4000000)
--23273-- Reading debug info from /lib/ld-2.7.so...
--23273-- ... CRC mismatch (computed 0f4d8d49 wanted a869dbba)
--23273-- Reading debug info from /usr/lib/debug/lib/ld-2.7.so...
--23273-- Reading syms from /usr/build/dialog/dialog-1.1-20110707/dialog (0x8048000)
--23273-- Reading syms from /usr/lib/valgrind/x86-linux/memcheck (0x38000000)
--23273-- object doesn't have a dynamic symbol table
--23273-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp
--23273-- Reading suppressions file: /usr/lib/valgrind/default.supp
--23273-- REDIR: 0x4015500 (index) redirected to 0x3802cf43 (vgPlain_x86_linux_REDIR_FOR_index)
--23273-- Reading syms from /usr/lib/valgrind/x86-linux/vgpreload_core.so (0x401E000)
--23273-- Reading syms from /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so (0x4020000)
==23273== WARNING: new redirection conflicts with existing -- ignoring it
--23273-- new: 0x04015500 (index ) R-> 0x040241e0 index
--23273-- REDIR: 0x40156f0 (strlen) redirected to 0x4024490 (strlen)
--23273-- Reading syms from /usr/lib/debug/libm-2.7.so (0x4027000)
--23273-- Reading syms from /usr/lib/debug/libc-2.7.so (0x404D000)
--23273-- REDIR: 0x40beaf0 (rindex) redirected to 0x40240c0 (rindex)
--23273-- REDIR: 0x40bf760 (memset) redirected to 0x4025380 (memset)
--23273-- REDIR: 0x40be160 (strcmp) redirected to 0x4024770 (strcmp)
--23273-- REDIR: 0x40be700 (strlen) redirected to 0x4024470 (strlen)
--23273-- REDIR: 0x40be910 (strncmp) redirected to 0x40246e0 (strncmp)
--23273-- REDIR: 0x40bdff0 (index) redirected to 0x40241b0 (index)
--23273-- REDIR: 0x40b9740 (free) redirected to 0x4022ad0 (free)
--23273-- REDIR: 0x40bb2c0 (calloc) redirected to 0x4021d60 (calloc)
--23273-- REDIR: 0x40c07e0 (strchrnul) redirected to 0x4025450 (strchrnul)
--23273-- REDIR: 0x40bb5e0 (malloc) redirected to 0x4023cb0 (malloc)
--23273-- REDIR: 0x40bfc80 (memcpy) redirected to 0x40248e0 (memcpy)
--23273-- REDIR: 0x40be7b0 (strnlen) redirected to 0x4024430 (strnlen)
--23273-- REDIR: 0x40bf7c0 (mempcpy) redirected to 0x40254b0 (mempcpy)
--23273-- REDIR: 0x40be1f0 (strcpy) redirected to 0x40244d0 (strcpy)
--23273-- REDIR: 0x40bba60 (realloc) redirected to 0x4023dc0 (realloc)
--23273-- REDIR: 0x40bea20 (strncpy) redirected to 0x40245a0 (strncpy)
--23273-- REDIR: 0x40bf690 (bcmp) redirected to 0x4025070 (bcmp)
--23273-- REDIR: 0x40bde40 (strcat) redirected to 0x4024240 (strcat)
==23273==
==23273== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 14 from 1)
--23273--
--23273-- supp: 14 dl-hack3-cond-1
==23273== malloc/free: in use at exit: 72,482 bytes in 382 blocks.
==23273== malloc/free: 419 allocs, 37 frees, 79,695 bytes allocated.
==23273==
==23273== searching for pointers to 382 not-freed blocks.
==23273== checked 149,580 bytes.
==23273==
==23273== 6 bytes in 1 blocks are still reachable in loss record 1 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8068E64: dlg_strclone (util.c:1740)
==23273== by 0x805FE72: same_cache2 (inputstr.c:212)
==23273== by 0x805FEE7: dlg_index_wchars (inputstr.c:342)
==23273== by 0x8059BBE: print_button (buttons.c:97)
==23273== by 0x805A265: dlg_draw_buttons (buttons.c:297)
==23273== by 0x806A2D0: dialog_yesno (yesno.c:98)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 6 bytes in 1 blocks are still reachable in loss record 2 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8068E64: dlg_strclone (util.c:1740)
==23273== by 0x805FE72: same_cache2 (inputstr.c:212)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x805A1F3: dlg_draw_buttons (buttons.c:296)
==23273== by 0x806A2D0: dialog_yesno (yesno.c:98)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 7 bytes in 2 blocks are still reachable in loss record 3 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8068E64: dlg_strclone (util.c:1740)
==23273== by 0x805FE72: same_cache2 (inputstr.c:212)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8059E3A: dlg_button_sizes (buttons.c:179)
==23273== by 0x8059F04: dlg_button_x_step (buttons.c:209)
==23273== by 0x805A02F: dlg_button_layout (buttons.c:234)
==23273== by 0x806A11F: dialog_yesno (yesno.c:71)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273==
==23273==
==23273== 11 bytes in 1 blocks are still reachable in loss record 4 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8068E64: dlg_strclone (util.c:1740)
==23273== by 0x805FE72: same_cache2 (inputstr.c:212)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8067711: real_auto_size (util.c:1101)
==23273== by 0x8067A1F: dlg_auto_size (util.c:1167)
==23273== by 0x806A14E: dialog_yesno (yesno.c:72)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 12 bytes in 1 blocks are still reachable in loss record 5 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x807F18F: _nc_add_to_try (add_tries.c:90)
==23273== by 0x80885C6: _nc_init_keytry (init_keytry.c:74)
==23273== by 0x80807F4: _nc_keypad (lib_options.c:262)
==23273== by 0x808035F: keypad (lib_options.c:129)
==23273== by 0x8066340: init_dialog (util.c:330)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 16 bytes in 1 blocks are still reachable in loss record 6 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x41165D0: tsearch (tsearch.c:281)
==23273== by 0x805FC92: make_cache (inputstr.c:149)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8066FD3: dlg_print_scrolled (util.c:886)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 16 bytes in 1 blocks are still reachable in loss record 7 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x41165D0: tsearch (tsearch.c:281)
==23273== by 0x805FC92: make_cache (inputstr.c:149)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FECD: dlg_index_wchars (inputstr.c:341)
==23273== by 0x8059BBE: print_button (buttons.c:97)
==23273== by 0x805A265: dlg_draw_buttons (buttons.c:297)
==23273== by 0x806A2D0: dialog_yesno (yesno.c:98)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 16 bytes in 1 blocks are still reachable in loss record 8 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x41165D0: tsearch (tsearch.c:281)
==23273== by 0x805FC92: make_cache (inputstr.c:149)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x805A1F3: dlg_draw_buttons (buttons.c:296)
==23273== by 0x806A2D0: dialog_yesno (yesno.c:98)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 16 bytes in 1 blocks are still reachable in loss record 9 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x41165D0: tsearch (tsearch.c:281)
==23273== by 0x805FC92: make_cache (inputstr.c:149)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8067711: real_auto_size (util.c:1101)
==23273== by 0x8067A1F: dlg_auto_size (util.c:1167)
==23273== by 0x806A14E: dialog_yesno (yesno.c:72)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273==
==23273==
==23273== 16 bytes in 1 blocks are still reachable in loss record 10 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x807F2D5: _nc_doalloc (doalloc.c:55)
==23273== by 0x8086167: _nc_trace_alloc (trace_buf.c:55)
==23273== by 0x8086261: _nc_trace_buf (trace_buf.c:90)
==23273== by 0x80864A7: _nc_visbuf2n (visbuf.c:94)
==23273== by 0x8086538: _nc_visbuf2 (visbuf.c:114)
==23273== by 0x8086553: _nc_visbuf (visbuf.c:120)
==23273== by 0x8088693: recur_tries (trace_tries.c:55)
==23273== by 0x80886D7: recur_tries (trace_tries.c:59)
==23273== by 0x80886D7: recur_tries (trace_tries.c:59)
==23273==
==23273==
==23273== 21 bytes in 1 blocks are still reachable in loss record 11 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x40BE45F: strdup (strdup.c:43)
==23273== by 0x8081EE0: setupterm (lib_setup.c:471)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 23 bytes in 1 blocks are still reachable in loss record 12 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8088526: _nc_home_terminfo (home_terminfo.c:57)
==23273== by 0x8085E1B: _nc_read_entry (read_entry.c:492)
==23273== by 0x8081834: grab_entry (lib_setup.c:255)
==23273== by 0x8081D46: setupterm (lib_setup.c:438)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 24 bytes in 1 blocks are still reachable in loss record 13 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x805FDE1: same_cache2 (inputstr.c:201)
==23273== by 0x805FEE7: dlg_index_wchars (inputstr.c:342)
==23273== by 0x8059BBE: print_button (buttons.c:97)
==23273== by 0x805A265: dlg_draw_buttons (buttons.c:297)
==23273== by 0x806A2D0: dialog_yesno (yesno.c:98)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 24 bytes in 1 blocks are still reachable in loss record 14 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x805FDE1: same_cache2 (inputstr.c:201)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x805A1F3: dlg_draw_buttons (buttons.c:296)
==23273== by 0x806A2D0: dialog_yesno (yesno.c:98)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 28 bytes in 1 blocks are still reachable in loss record 15 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x805FC0F: make_cache (inputstr.c:139)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8066FD3: dlg_print_scrolled (util.c:886)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 28 bytes in 1 blocks are still reachable in loss record 16 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x805FC0F: make_cache (inputstr.c:139)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FECD: dlg_index_wchars (inputstr.c:341)
==23273== by 0x8059BBE: print_button (buttons.c:97)
==23273== by 0x805A265: dlg_draw_buttons (buttons.c:297)
==23273== by 0x806A2D0: dialog_yesno (yesno.c:98)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 28 bytes in 1 blocks are still reachable in loss record 17 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x805FC0F: make_cache (inputstr.c:139)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x805A1F3: dlg_draw_buttons (buttons.c:296)
==23273== by 0x806A2D0: dialog_yesno (yesno.c:98)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 28 bytes in 1 blocks are still reachable in loss record 18 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x805FC0F: make_cache (inputstr.c:139)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8067711: real_auto_size (util.c:1101)
==23273== by 0x8067A1F: dlg_auto_size (util.c:1167)
==23273== by 0x806A14E: dialog_yesno (yesno.c:72)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 28 bytes in 2 blocks are still reachable in loss record 19 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x805FDE1: same_cache2 (inputstr.c:201)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8059E3A: dlg_button_sizes (buttons.c:179)
==23273== by 0x8059F04: dlg_button_x_step (buttons.c:209)
==23273== by 0x805A02F: dlg_button_layout (buttons.c:234)
==23273== by 0x806A11F: dialog_yesno (yesno.c:71)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 32 bytes in 2 blocks are still reachable in loss record 20 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x41165D0: tsearch (tsearch.c:281)
==23273== by 0x805FC92: make_cache (inputstr.c:149)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8059E3A: dlg_button_sizes (buttons.c:179)
==23273== by 0x8059F04: dlg_button_x_step (buttons.c:209)
==23273== by 0x805A02F: dlg_button_layout (buttons.c:234)
==23273== by 0x806A11F: dialog_yesno (yesno.c:71)
==23273==
==23273==
==23273== 33 bytes in 1 blocks are still reachable in loss record 21 of 62
==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429)
==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50)
==23273== by 0x808620A: _nc_trace_alloc (trace_buf.c:63)
==23273== by 0x8086261: _nc_trace_buf (trace_buf.c:90)
==23273== by 0x80864A7: _nc_visbuf2n (visbuf.c:94)
==23273== by 0x8086538: _nc_visbuf2 (visbuf.c:114)
==23273== by 0x8086553: _nc_visbuf (visbuf.c:120)
==23273== by 0x8088693: recur_tries (trace_tries.c:55)
==23273== by 0x80886D7: recur_tries (trace_tries.c:59)
==23273== by 0x80886D7: recur_tries (trace_tries.c:59)
==23273==
==23273==
==23273== 44 bytes in 1 blocks are still reachable in loss record 22 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x805FDE1: same_cache2 (inputstr.c:201)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8067711: real_auto_size (util.c:1101)
==23273== by 0x8067A1F: dlg_auto_size (util.c:1167)
==23273== by 0x806A14E: dialog_yesno (yesno.c:72)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 47 bytes in 1 blocks are still reachable in loss record 23 of 62
==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429)
==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50)
==23273== by 0x8085368: read_termtype (read_entry.c:283)
==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392)
==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413)
==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438)
==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500)
==23273== by 0x8081834: grab_entry (lib_setup.c:255)
==23273== by 0x8081D46: setupterm (lib_setup.c:438)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273==
==23273==
==23273== 55 bytes in 1 blocks are still reachable in loss record 24 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8084EC3: read_termtype (read_entry.c:207)
==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392)
==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413)
==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438)
==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500)
==23273== by 0x8081834: grab_entry (lib_setup.c:255)
==23273== by 0x8081D46: setupterm (lib_setup.c:438)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273==
==23273==
==23273== 56 bytes in 2 blocks are still reachable in loss record 25 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x805FC0F: make_cache (inputstr.c:139)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8059E3A: dlg_button_sizes (buttons.c:179)
==23273== by 0x8059F04: dlg_button_x_step (buttons.c:209)
==23273== by 0x805A02F: dlg_button_layout (buttons.c:234)
==23273== by 0x806A11F: dialog_yesno (yesno.c:71)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273==
==23273==
==23273== 66 bytes in 1 blocks are still reachable in loss record 26 of 62
==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429)
==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50)
==23273== by 0x808238C: get_space (lib_tparm.c:155)
==23273== by 0x8082443: save_number (lib_tparm.c:180)
==23273== by 0x8082D8B: tparam_internal (lib_tparm.c:564)
==23273== by 0x80833C4: tparm (lib_tparm.c:788)
==23273== by 0x80704CF: _nc_mvcur_init (lib_mvcur.c:358)
==23273== by 0x8072684: newterm (lib_newterm.c:191)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273==
==23273==
==23273== 80 bytes in 1 blocks are still reachable in loss record 27 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8072E08: _nc_makenew (lib_newwin.c:218)
==23273== by 0x807299B: newwin (lib_newwin.c:126)
==23273== by 0x8074F9A: _nc_setupscreen (lib_set_term.c:459)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 80 bytes in 1 blocks are still reachable in loss record 28 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8072E08: _nc_makenew (lib_newwin.c:218)
==23273== by 0x807299B: newwin (lib_newwin.c:126)
==23273== by 0x8074CB3: _nc_setupscreen (lib_set_term.c:414)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 80 bytes in 1 blocks are still reachable in loss record 29 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8072E08: _nc_makenew (lib_newwin.c:218)
==23273== by 0x807299B: newwin (lib_newwin.c:126)
==23273== by 0x8074C55: _nc_setupscreen (lib_set_term.c:410)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 80 bytes in 1 blocks are still reachable in loss record 30 of 62
==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429)
==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50)
==23273== by 0x808538F: read_termtype (read_entry.c:284)
==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392)
==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413)
==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438)
==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500)
==23273== by 0x8081834: grab_entry (lib_setup.c:255)
==23273== by 0x8081D46: setupterm (lib_setup.c:438)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273==
==23273==
==23273== 112 bytes in 7 blocks are still reachable in loss record 31 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x41165D0: tsearch (tsearch.c:281)
==23273== by 0x805FC92: make_cache (inputstr.c:149)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8066A0A: dlg_print_line (util.c:668)
==23273== by 0x8066E40: justify_text (util.c:813)
==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843)
==23273== by 0x806703E: dlg_print_scrolled (util.c:892)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273==
==23273==
==23273== 118 bytes in 1 blocks are still reachable in loss record 32 of 62
==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429)
==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50)
==23273== by 0x8082957: _nc_tparm_analyze (lib_tparm.c:374)
==23273== by 0x8082B5E: tparam_internal (lib_tparm.c:502)
==23273== by 0x80833C4: tparm (lib_tparm.c:788)
==23273== by 0x80782E6: vidputs (lib_vidattr.c:187)
==23273== by 0x8078B59: vidattr (lib_vidattr.c:270)
==23273== by 0x807ACE8: ClrToEOS (tty_update.c:957)
==23273== by 0x807AF54: ClrBottom (tty_update.c:1006)
==23273== by 0x807AB1C: ClrUpdate (tty_update.c:897)
==23273==
==23273==
==23273== 128 bytes in 8 blocks are still reachable in loss record 33 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x41165D0: tsearch (tsearch.c:281)
==23273== by 0x805FC92: make_cache (inputstr.c:149)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FECD: dlg_index_wchars (inputstr.c:341)
==23273== by 0x8066A18: dlg_print_line (util.c:669)
==23273== by 0x8066E40: justify_text (util.c:813)
==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843)
==23273== by 0x806703E: dlg_print_scrolled (util.c:892)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273==
==23273==
==23273== 128 bytes in 1 blocks are still reachable in loss record 34 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x806BDE0: start_color (lib_color.c:238)
==23273== by 0x80663B1: dlg_color_setup (util.c:360)
==23273== by 0x806638E: init_dialog (util.c:342)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 128 bytes in 1 blocks are still reachable in loss record 35 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x806BDA7: start_color (lib_color.c:236)
==23273== by 0x80663B1: dlg_color_setup (util.c:360)
==23273== by 0x806638E: init_dialog (util.c:342)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 160 bytes in 1 blocks are still reachable in loss record 36 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8087176: _nc_hash_map (hashmap.c:299)
==23273== by 0x80865F4: _nc_scroll_optimize (hardscroll.c:199)
==23273== by 0x807A762: doupdate (tty_update.c:778)
==23273== by 0x8073C0A: wrefresh (lib_refresh.c:58)
==23273== by 0x806D95D: _nc_wgetch (lib_getch.c:295)
==23273== by 0x806DD0D: wgetch (lib_getch.c:467)
==23273== by 0x80654FC: really_getch (ui_getc.c:352)
==23273== by 0x806566B: dlg_getc (ui_getc.c:423)
==23273== by 0x80627C4: mouse_wgetch (mousewget.c:35)
==23273==
==23273==
==23273== 160 bytes in 1 blocks are still reachable in loss record 37 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8087141: _nc_hash_map (hashmap.c:297)
==23273== by 0x80865F4: _nc_scroll_optimize (hardscroll.c:199)
==23273== by 0x807A762: doupdate (tty_update.c:778)
==23273== by 0x8073C0A: wrefresh (lib_refresh.c:58)
==23273== by 0x806D95D: _nc_wgetch (lib_getch.c:295)
==23273== by 0x806DD0D: wgetch (lib_getch.c:467)
==23273== by 0x80654FC: really_getch (ui_getc.c:352)
==23273== by 0x806566B: dlg_getc (ui_getc.c:423)
==23273== by 0x80627C4: mouse_wgetch (mousewget.c:35)
==23273==
==23273==
==23273== 160 bytes in 1 blocks are still reachable in loss record 38 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x807F2D5: _nc_doalloc (doalloc.c:55)
==23273== by 0x80865CB: _nc_scroll_optimize (hardscroll.c:192)
==23273== by 0x807A762: doupdate (tty_update.c:778)
==23273== by 0x8073C0A: wrefresh (lib_refresh.c:58)
==23273== by 0x806D95D: _nc_wgetch (lib_getch.c:295)
==23273== by 0x806DD0D: wgetch (lib_getch.c:467)
==23273== by 0x80654FC: really_getch (ui_getc.c:352)
==23273== by 0x806566B: dlg_getc (ui_getc.c:423)
==23273== by 0x80627C4: mouse_wgetch (mousewget.c:35)
==23273==
==23273==
==23273== 172 bytes in 1 blocks are still reachable in loss record 39 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8081CD7: setupterm (lib_setup.c:431)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 196 bytes in 7 blocks are still reachable in loss record 40 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x805FC0F: make_cache (inputstr.c:139)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396)
==23273== by 0x8066A0A: dlg_print_line (util.c:668)
==23273== by 0x8066E40: justify_text (util.c:813)
==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843)
==23273== by 0x806703E: dlg_print_scrolled (util.c:892)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273==
==23273==
==23273== 224 bytes in 8 blocks are still reachable in loss record 41 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x805FC0F: make_cache (inputstr.c:139)
==23273== by 0x805FCF7: load_cache (inputstr.c:161)
==23273== by 0x805FECD: dlg_index_wchars (inputstr.c:341)
==23273== by 0x8066A18: dlg_print_line (util.c:669)
==23273== by 0x8066E40: justify_text (util.c:813)
==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843)
==23273== by 0x806703E: dlg_print_scrolled (util.c:892)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273==
==23273==
==23273== 252 bytes in 1 blocks are still reachable in loss record 42 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x80858B3: read_termtype (read_entry.c:345)
==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392)
==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413)
==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438)
==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500)
==23273== by 0x8081834: grab_entry (lib_setup.c:255)
==23273== by 0x8081D46: setupterm (lib_setup.c:438)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273==
==23273==
==23273== 421 bytes in 1 blocks are still reachable in loss record 43 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8068E64: dlg_strclone (util.c:1740)
==23273== by 0x805FE72: same_cache2 (inputstr.c:212)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8066FD3: dlg_print_scrolled (util.c:886)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 480 bytes in 1 blocks are still reachable in loss record 44 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8072E36: _nc_makenew (lib_newwin.c:223)
==23273== by 0x807299B: newwin (lib_newwin.c:126)
==23273== by 0x8074F9A: _nc_setupscreen (lib_set_term.c:459)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 480 bytes in 1 blocks are still reachable in loss record 45 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8072E36: _nc_makenew (lib_newwin.c:223)
==23273== by 0x807299B: newwin (lib_newwin.c:126)
==23273== by 0x8074CB3: _nc_setupscreen (lib_set_term.c:414)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 480 bytes in 1 blocks are still reachable in loss record 46 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x8072E36: _nc_makenew (lib_newwin.c:223)
==23273== by 0x807299B: newwin (lib_newwin.c:126)
==23273== by 0x8074C55: _nc_setupscreen (lib_set_term.c:410)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 689 bytes in 1 blocks are still reachable in loss record 47 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8085659: read_termtype (read_entry.c:318)
==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392)
==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413)
==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438)
==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500)
==23273== by 0x8081834: grab_entry (lib_setup.c:255)
==23273== by 0x8081D46: setupterm (lib_setup.c:438)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273==
==23273==
==23273== 780 bytes in 65 blocks are still reachable in loss record 48 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x807F1FF: _nc_add_to_try (add_tries.c:104)
==23273== by 0x80885C6: _nc_init_keytry (init_keytry.c:74)
==23273== by 0x80807F4: _nc_keypad (lib_options.c:262)
==23273== by 0x808035F: keypad (lib_options.c:129)
==23273== by 0x8066340: init_dialog (util.c:330)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 1,008 bytes in 84 blocks are still reachable in loss record 49 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x807F119: _nc_add_to_try (add_tries.c:77)
==23273== by 0x80885C6: _nc_init_keytry (init_keytry.c:74)
==23273== by 0x80807F4: _nc_keypad (lib_options.c:262)
==23273== by 0x808035F: keypad (lib_options.c:129)
==23273== by 0x8066340: init_dialog (util.c:330)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 1,338 bytes in 1 blocks are still reachable in loss record 50 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8084DF7: read_termtype (read_entry.c:193)
==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392)
==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413)
==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438)
==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500)
==23273== by 0x8081834: grab_entry (lib_setup.c:255)
==23273== by 0x8081D46: setupterm (lib_setup.c:438)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273==
==23273==
==23273== 1,382 bytes in 7 blocks are still reachable in loss record 51 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8068E64: dlg_strclone (util.c:1740)
==23273== by 0x805FE72: same_cache2 (inputstr.c:212)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8066A0A: dlg_print_line (util.c:668)
==23273== by 0x8066E40: justify_text (util.c:813)
==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843)
==23273== by 0x806703E: dlg_print_scrolled (util.c:892)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273==
==23273==
==23273== 1,520 bytes in 1 blocks are still reachable in loss record 52 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x80747CF: _nc_setupscreen (lib_set_term.c:221)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 1,640 bytes in 1 blocks are still reachable in loss record 53 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8087007: _nc_hash_map (hashmap.c:277)
==23273== by 0x80865F4: _nc_scroll_optimize (hardscroll.c:199)
==23273== by 0x807A762: doupdate (tty_update.c:778)
==23273== by 0x8073C0A: wrefresh (lib_refresh.c:58)
==23273== by 0x806D95D: _nc_wgetch (lib_getch.c:295)
==23273== by 0x806DD0D: wgetch (lib_getch.c:467)
==23273== by 0x80654FC: really_getch (ui_getc.c:352)
==23273== by 0x806566B: dlg_getc (ui_getc.c:423)
==23273== by 0x80627C4: mouse_wgetch (mousewget.c:35)
==23273==
==23273==
==23273== 1,684 bytes in 1 blocks are still reachable in loss record 54 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x805FDE1: same_cache2 (inputstr.c:201)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8060166: dlg_count_columns (inputstr.c:473)
==23273== by 0x8066FD3: dlg_print_scrolled (util.c:886)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 1,803 bytes in 8 blocks are still reachable in loss record 55 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8068E64: dlg_strclone (util.c:1740)
==23273== by 0x805FE72: same_cache2 (inputstr.c:212)
==23273== by 0x805FEE7: dlg_index_wchars (inputstr.c:342)
==23273== by 0x8066A18: dlg_print_line (util.c:669)
==23273== by 0x8066E40: justify_text (util.c:813)
==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843)
==23273== by 0x806703E: dlg_print_scrolled (util.c:892)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273==
==23273==
==23273== 1,892 bytes in 1 blocks are still reachable in loss record 56 of 62
==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429)
==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50)
==23273== by 0x80853BA: read_termtype (read_entry.c:285)
==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392)
==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413)
==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438)
==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500)
==23273== by 0x8081834: grab_entry (lib_setup.c:255)
==23273== by 0x8081D46: setupterm (lib_setup.c:438)
==23273== by 0x8072292: newterm (lib_newterm.c:115)
==23273==
==23273==
==23273== 2,800 bytes in 1 blocks are still reachable in loss record 57 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x8085F59: _nc_set_buffer (setbuf.c:119)
==23273== by 0x807481F: _nc_setupscreen (lib_set_term.c:232)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 5,528 bytes in 7 blocks are still reachable in loss record 58 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x805FDE1: same_cache2 (inputstr.c:201)
==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397)
==23273== by 0x8066A0A: dlg_print_line (util.c:668)
==23273== by 0x8066E40: justify_text (util.c:813)
==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843)
==23273== by 0x806703E: dlg_print_scrolled (util.c:892)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 7,212 bytes in 8 blocks are still reachable in loss record 59 of 62
==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==23273== by 0x805FDE1: same_cache2 (inputstr.c:201)
==23273== by 0x805FEE7: dlg_index_wchars (inputstr.c:342)
==23273== by 0x8066A18: dlg_print_line (util.c:669)
==23273== by 0x8066E40: justify_text (util.c:813)
==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843)
==23273== by 0x806703E: dlg_print_scrolled (util.c:892)
==23273== by 0x806A30C: dialog_yesno (yesno.c:104)
==23273== by 0x804A728: call_yesno (dialog.c:600)
==23273== by 0x804CC56: main (dialog.c:1679)
==23273==
==23273==
==23273== 12,800 bytes in 40 blocks are still reachable in loss record 60 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x80729EC: newwin (lib_newwin.c:130)
==23273== by 0x8074F9A: _nc_setupscreen (lib_set_term.c:459)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 12,800 bytes in 40 blocks are still reachable in loss record 61 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x80729EC: newwin (lib_newwin.c:130)
==23273== by 0x8074CB3: _nc_setupscreen (lib_set_term.c:414)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273==
==23273== 12,800 bytes in 40 blocks are still reachable in loss record 62 of 62
==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397)
==23273== by 0x80729EC: newwin (lib_newwin.c:130)
==23273== by 0x8074C55: _nc_setupscreen (lib_set_term.c:410)
==23273== by 0x80723F1: newterm (lib_newterm.c:146)
==23273== by 0x806E82C: initscr (lib_initscr.c:83)
==23273== by 0x8066211: init_dialog (util.c:292)
==23273== by 0x804C880: main (dialog.c:1604)
==23273==
==23273== LEAK SUMMARY:
==23273== definitely lost: 0 bytes in 0 blocks.
==23273== possibly lost: 0 bytes in 0 blocks.
==23273== still reachable: 72,482 bytes in 382 blocks.
==23273== suppressed: 0 bytes in 0 blocks.
--23273-- memcheck: sanity checks: 8 cheap, 2 expensive
--23273-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--23273-- memcheck: auxmaps_L1: 0 searches, 0 cmps, ratio 0:10
--23273-- memcheck: auxmaps_L2: 0 searches, 0 nodes
--23273-- memcheck: SMs: n_issued = 11 (176k, 0M)
--23273-- memcheck: SMs: n_deissued = 0 (0k, 0M)
--23273-- memcheck: SMs: max_noaccess = 65535 (1048560k, 1023M)
--23273-- memcheck: SMs: max_undefined = 0 (0k, 0M)
--23273-- memcheck: SMs: max_defined = 25 (400k, 0M)
--23273-- memcheck: SMs: max_non_DSM = 11 (176k, 0M)
--23273-- memcheck: max sec V bit nodes: 21 (1k, 0M)
--23273-- memcheck: set_sec_vbits8 calls: 130 (new: 21, updates: 109)
--23273-- memcheck: max shadow mem size: 481k, 0M
--23273-- translate: fast SP updates identified: 4,767 ( 83.0%)
--23273-- translate: generic_known SP updates identified: 612 ( 10.6%)
--23273-- translate: generic_unknown SP updates identified: 358 ( 6.2%)
--23273-- tt/tc: 11,509 tt lookups requiring 11,938 probes
--23273-- tt/tc: 11,509 fast-cache updates, 3 flushes
--23273-- transtab: new 5,099 (117,852 -> 1,563,594; ratio 132:10) [0 scs]
--23273-- transtab: dumped 0 (0 -> ??)
--23273-- transtab: discarded 9 (222 -> ??)
--23273-- scheduler: 864,676 jumps (bb entries).
--23273-- scheduler: 8/7,086 major/minor sched events.
--23273-- sanity: 9 cheap, 2 expensive checks.
--23273-- exectx: 769 lists, 102 contexts (avg 0 per list)
--23273-- exectx: 470 searches, 372 full compares (791 per 1000)
--23273-- exectx: 0 cmp2, 36 cmp4, 2,470 cmpAll
--23273-- errormgr: 69 supplist searches, 5,672 comparisons during search
--23273-- errormgr: 14 errlist searches, 36 comparisons during search

View File

@ -1,5 +1,5 @@
/*
* $Id: tailbox.c,v 1.61 2011/01/16 21:48:16 tom Exp $
* $Id: tailbox.c,v 1.63 2011/06/27 08:19:43 tom Exp $
*
* tailbox.c -- implements the tail box
*
@ -284,6 +284,7 @@ dialog_tailbox(const char *title, const char *file, int height, int width, int b
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_BEGIN, '0' ),
DLG_KEYS_DATA( DLGK_BEGIN, KEY_BEG ),
@ -338,6 +339,7 @@ dialog_tailbox(const char *title, const char *file, int height, int width, int b
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
dlg_draw_bottom_box(dialog);
dlg_draw_title(dialog, title);
dlg_draw_helpline(dialog, FALSE);
if (!bg_task) {
buttons = dlg_exit_label();

View File

@ -1,5 +1,5 @@
/*
* $Id: textbox.c,v 1.99 2011/01/16 22:20:34 tom Exp $
* $Id: textbox.c,v 1.101 2011/06/29 09:53:03 tom Exp $
*
* textbox.c -- implements the text box
*
@ -452,6 +452,7 @@ get_search_term(WINDOW *dialog, char *input, int height, int width)
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
INPUTSTR_BINDINGS,
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
END_KEYS_BINDING
};
@ -628,6 +629,7 @@ dialog_textbox(const char *title, const char *file, int height, int width)
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_GRID_DOWN, 'J' ),
DLG_KEYS_DATA( DLGK_GRID_DOWN, 'j' ),
@ -819,7 +821,10 @@ dialog_textbox(const char *title, const char *file, int height, int width)
FALSE, width);
break;
case DLGK_ENTER:
result = dlg_exit_buttoncode(button);
if (dialog_vars.nook)
result = DLG_EXIT_OK;
else
result = dlg_exit_buttoncode(button);
break;
case DLGK_PAGE_FIRST:
if (!obj.begin_reached) {

View File

@ -1,5 +1,5 @@
/*
* $Id: timebox.c,v 1.43 2011/01/18 01:07:45 Garrett.Cooper Exp $
* $Id: timebox.c,v 1.45 2011/06/27 08:20:22 tom Exp $
*
* timebox.c -- implements the timebox dialog
*
@ -148,6 +148,7 @@ dialog_timebox(const char *title,
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
DLG_KEYS_DATA( DLGK_DELETE_RIGHT,KEY_DC ),
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
DLG_KEYS_DATA( DLGK_FIELD_FIRST,KEY_HOME ),
@ -223,6 +224,7 @@ dialog_timebox(const char *title,
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
dlg_draw_bottom_box(dialog);
dlg_draw_title(dialog, title);
dlg_draw_helpline(dialog, FALSE);
wattrset(dialog, dialog_attr);
dlg_print_autowrap(dialog, prompt, height, width);

View File

@ -1,5 +1,5 @@
/*
* $Id: trace.c,v 1.12 2011/01/13 01:36:34 tom Exp $
* $Id: trace.c,v 1.14 2011/06/21 21:12:56 tom Exp $
*
* trace.c -- implements screen-dump and keystroke-logging
*
@ -119,6 +119,7 @@ dlg_trace_chr(int ch, int fkey)
CASE(DLGK_BEGIN);
CASE(DLGK_FINAL);
CASE(DLGK_SELECT);
CASE(DLGK_HELPFILE);
CASE(DLGK_TRACE);
}
}
@ -144,6 +145,7 @@ dlg_trace(const char *fname)
myFP = fopen(fname, "a");
if (myFP != 0) {
dlg_trace_time("** opened at");
dlg_trace_msg("** dialog %s\n", dialog_version());
}
}
} else if (myFP != 0) {

174
ui_getc.c
View File

@ -1,5 +1,5 @@
/*
* $Id: ui_getc.c,v 1.59 2011/02/28 10:56:15 tom Exp $
* $Id: ui_getc.c,v 1.63 2011/07/07 22:05:58 tom Exp $
*
* ui_getc.c - user interface glue for getc()
*
@ -385,6 +385,9 @@ prev_callback(DIALOG_CALLBACK * p)
return p;
}
#define isBeforeChr(chr) ((chr) == before_chr && !before_fkey)
#define isBeforeFkey(chr) ((chr) == before_chr && before_fkey)
/*
* Read a character from the given window. Handle repainting here (to simplify
* things in the calling application). Also, if input-callback(s) are set up,
@ -396,7 +399,8 @@ dlg_getc(WINDOW *win, int *fkey)
{
WINDOW *save_win = win;
int ch = ERR;
int before_lookup;
int before_chr;
int before_fkey;
int result;
bool done = FALSE;
bool literal = FALSE;
@ -411,6 +415,8 @@ dlg_getc(WINDOW *win, int *fkey)
wtimeout(win, interval);
while (!done) {
bool handle_others = FALSE;
/*
* If there was no pending file-input, check the keyboard.
*/
@ -420,80 +426,108 @@ dlg_getc(WINDOW *win, int *fkey)
continue;
}
before_lookup = ch;
before_chr = ch;
before_fkey = *fkey;
ch = dlg_lookup_key(win, ch, fkey);
dlg_trace_chr(ch, *fkey);
current = time((time_t *) 0);
switch (ch) {
case CHR_LITERAL:
if (!literal) {
literal = TRUE;
keypad(win, FALSE);
continue;
}
break;
case CHR_REPAINT:
(void) touchwin(win);
(void) wrefresh(curscr);
break;
case ERR: /* wtimeout() in effect; check for file I/O */
if (interval > 0
&& current >= expired) {
dlg_exiterr("timeout");
}
if (!valid_file(stdin)
|| !valid_file(dialog_state.screen_output)) {
ch = ESC;
done = TRUE;
} else if (check_inputs()) {
if (handle_inputs(win))
dlg_raise_window(win);
else
done = TRUE;
} else {
done = (interval <= 0);
}
break;
case DLGK_FIELD_PREV:
/* FALLTHRU */
case KEY_BTAB:
/* FALLTHRU */
case DLGK_FIELD_NEXT:
/* FALLTHRU */
case TAB:
/* Handle tab/backtab as a special case for traversing between the
* nominal "current" window, and other windows having callbacks.
* If the nominal (control) window closes, we'll close the windows
* with callbacks.
*/
if (dialog_state.getc_callbacks != 0 &&
(before_lookup == TAB ||
before_lookup == KEY_BTAB)) {
if (before_lookup == TAB)
p = next_callback(p);
else
p = prev_callback(p);
if ((dialog_state.getc_redirect = p) != 0) {
win = p->win;
} else {
win = save_win;
/*
* If we acquired a fkey value, then it is one of dialog's builtin
* codes such as DLGK_HELPFILE.
*/
if (!*fkey || *fkey != before_fkey) {
switch (ch) {
case CHR_LITERAL:
if (!literal) {
literal = TRUE;
keypad(win, FALSE);
continue;
}
dlg_raise_window(win);
break;
}
/* FALLTHRU */
default:
case CHR_REPAINT:
(void) touchwin(win);
(void) wrefresh(curscr);
break;
case ERR: /* wtimeout() in effect; check for file I/O */
if (interval > 0
&& current >= expired) {
dlg_exiterr("timeout");
}
if (!valid_file(stdin)
|| !valid_file(dialog_state.screen_output)) {
ch = ESC;
done = TRUE;
} else if (check_inputs()) {
if (handle_inputs(win))
dlg_raise_window(win);
else
done = TRUE;
} else {
done = (interval <= 0);
}
break;
case DLGK_HELPFILE:
if (dialog_vars.help_file) {
int yold, xold;
getyx(win, yold, xold);
dialog_helpfile("HELP", dialog_vars.help_file, 0, 0);
dlg_raise_window(win);
wmove(win, yold, xold);
}
continue;
case DLGK_FIELD_PREV:
/* FALLTHRU */
case KEY_BTAB:
/* FALLTHRU */
case DLGK_FIELD_NEXT:
/* FALLTHRU */
case TAB:
/* Handle tab/backtab as a special case for traversing between
* the nominal "current" window, and other windows having
* callbacks. If the nominal (control) window closes, we'll
* close the windows with callbacks.
*/
if (dialog_state.getc_callbacks != 0 &&
(isBeforeChr(TAB) ||
isBeforeFkey(KEY_BTAB))) {
p = (isBeforeChr(TAB)
? next_callback(p)
: prev_callback(p));
if ((dialog_state.getc_redirect = p) != 0) {
win = p->win;
} else {
win = save_win;
}
dlg_raise_window(win);
break;
}
/* FALLTHRU */
default:
#ifdef NO_LEAKS
if (before_lookup == DLG_CTRL('P')) {
/* for testing, ^P closes the connection */
close(0);
close(1);
close(2);
break;
}
if (isBeforeChr(DLG_CTRL('P'))) {
/* for testing, ^P closes the connection */
close(0);
close(1);
close(2);
break;
}
#endif
handle_others = TRUE;
break;
#ifdef HAVE_DLG_TRACE
case CHR_TRACE:
dlg_trace_win(win);
break;
#endif
}
} else {
handle_others = TRUE;
}
if (handle_others) {
if ((p = dialog_state.getc_redirect) != 0) {
if (!(p->handle_getc(p, ch, *fkey, &result))) {
dlg_remove_callback(p);
@ -503,12 +537,6 @@ dlg_getc(WINDOW *win, int *fkey)
} else {
done = TRUE;
}
break;
#ifdef HAVE_DLG_TRACE
case CHR_TRACE:
dlg_trace_win(win);
break;
#endif
}
}
if (literal)

433
util.c
View File

@ -1,5 +1,5 @@
/*
* $Id: util.c,v 1.211 2011/01/19 00:31:43 tom Exp $
* $Id: util.c,v 1.227 2011/07/07 23:42:30 tom Exp $
*
* util.c -- miscellaneous utilities for dialog
*
@ -37,6 +37,20 @@
#endif
#endif
#if defined(HAVE_WCHGAT)
# if defined(NCURSES_VERSION_PATCH)
# if NCURSES_VERSION_PATCH >= 20060715
# define USE_WCHGAT 1
# else
# define USE_WCHGAT 0
# endif
# else
# define USE_WCHGAT 1
# endif
#else
# define USE_WCHGAT 0
#endif
/* globals */
DIALOG_STATE dialog_state;
DIALOG_VARS dialog_vars;
@ -61,6 +75,8 @@ DIALOG_VARS dialog_vars;
#define DATA(atr,upr,lwr,cmt) { atr COLOR_DATA(upr) RC_DATA(lwr,cmt) }
#define UseShadow(dw) ((dw) != 0 && (dw)->normal != 0 && (dw)->shadow != 0)
/*
* Table of color and attribute values, default is for mono display.
*/
@ -411,7 +427,7 @@ dlg_get_attrs(WINDOW *win)
{
chtype result;
#ifdef HAVE_GETATTRS
result = getattrs(win);
result = (chtype) getattrs(win);
#else
attr_t my_result;
short my_pair;
@ -487,6 +503,7 @@ end_dialog(void)
}
}
#define ESCAPE_LEN 3
#define isOurEscape(p) (((p)[0] == '\\') && ((p)[1] == 'Z') && ((p)[2] != 0))
static int
@ -500,7 +517,7 @@ centered(int width, const char *string)
if (dialog_vars.colors) {
for (n = 0; n < len; ++n) {
if (isOurEscape(string + n)) {
hide += 3;
hide += ESCAPE_LEN;
}
}
}
@ -661,6 +678,7 @@ dlg_print_line(WINDOW *win,
{
const char *wrap_ptr = prompt;
const char *test_ptr = prompt;
const char *hide_ptr = 0;
const int *cols = dlg_index_columns(prompt);
const int *indx = dlg_index_wchars(prompt);
int wrap_inx = 0;
@ -687,8 +705,9 @@ dlg_print_line(WINDOW *win,
wrap_inx = n;
*x = cur_x;
} else if (isOurEscape(test_ptr)) {
hidden += 3;
n += 2;
hide_ptr = test_ptr;
hidden += ESCAPE_LEN;
n += (ESCAPE_LEN - 1);
}
cur_x = lm + tabbed + cols[n + 1];
if (cur_x > (rm + hidden))
@ -724,6 +743,23 @@ dlg_print_line(WINDOW *win,
}
#endif
/*
* If we found hidden text past the last point that we will display,
* discount that from the displayed length.
*/
if ((hide_ptr != 0) && (hide_ptr >= wrap_ptr)) {
hidden -= ESCAPE_LEN;
test_ptr = wrap_ptr;
while (test_ptr < wrap_ptr) {
if (isOurEscape(test_ptr)) {
hidden -= ESCAPE_LEN;
test_ptr += ESCAPE_LEN;
} else {
++test_ptr;
}
}
}
/*
* Print the line if we have a window pointer. Otherwise this routine
* is just being called for sizing the window.
@ -736,6 +772,8 @@ dlg_print_line(WINDOW *win,
if (*x == 1)
*x = rm;
*x -= hidden;
/* Find the start of the next line and return a pointer to it */
test_ptr = wrap_ptr;
while (*test_ptr == ' ')
@ -863,43 +901,49 @@ dlg_print_scrolled(WINDOW *win,
high = len;
#endif
dummy = newwin(high, width, 0, 0);
wbkgdset(dummy, dialog_attr | ' ');
wattrset(dummy, dialog_attr);
werase(dummy);
dlg_print_autowrap(dummy, prompt, high, width);
getyx(dummy, y, x);
if (dummy == 0) {
wattrset(win, dialog_attr);
dlg_print_autowrap(win, prompt, height + 1 + (3 * MARGIN), width);
last = 0;
} else {
wbkgdset(dummy, dialog_attr | ' ');
wattrset(dummy, dialog_attr);
werase(dummy);
dlg_print_autowrap(dummy, prompt, high, width);
getyx(dummy, y, x);
copywin(dummy, /* srcwin */
win, /* dstwin */
offset + MARGIN, /* sminrow */
MARGIN, /* smincol */
MARGIN, /* dminrow */
MARGIN, /* dmincol */
height, /* dmaxrow */
wide, /* dmaxcol */
FALSE);
copywin(dummy, /* srcwin */
win, /* dstwin */
offset + MARGIN, /* sminrow */
MARGIN, /* smincol */
MARGIN, /* dminrow */
MARGIN, /* dmincol */
height, /* dmaxrow */
wide, /* dmaxcol */
FALSE);
delwin(dummy);
delwin(dummy);
/* if the text is incomplete, or we have scrolled, show the percentage */
if (y > 0 && wide > 4) {
percent = (int) ((height + offset) * 100.0 / y);
if (percent < 0)
percent = 0;
if (percent > 100)
percent = 100;
if (offset != 0 || percent != 100) {
(void) wattrset(win, position_indicator_attr);
(void) wmove(win, MARGIN + height, wide - 4);
(void) sprintf(buffer, "%d%%", percent);
(void) waddstr(win, buffer);
if ((len = (int) strlen(buffer)) < 4) {
wattrset(win, border_attr);
whline(win, dlg_boxchar(ACS_HLINE), 4 - len);
/* if the text is incomplete, or we have scrolled, show the percentage */
if (y > 0 && wide > 4) {
percent = (int) ((height + offset) * 100.0 / y);
if (percent < 0)
percent = 0;
if (percent > 100)
percent = 100;
if (offset != 0 || percent != 100) {
(void) wattrset(win, position_indicator_attr);
(void) wmove(win, MARGIN + height, wide - 4);
(void) sprintf(buffer, "%d%%", percent);
(void) waddstr(win, buffer);
if ((len = (int) strlen(buffer)) < 4) {
wattrset(win, border_attr);
whline(win, dlg_boxchar(ACS_HLINE), 4 - len);
}
}
}
last = (y - height);
}
last = (y - height);
} else
#endif
{
@ -1037,6 +1081,25 @@ longest_word(const char *string)
return result;
}
static int
count_real_columns(const char *text)
{
int result = dlg_count_columns(text);
if (result && dialog_vars.colors) {
int hidden = 0;
while (*text) {
if (isOurEscape(text)) {
hidden += ESCAPE_LEN;
text += ESCAPE_LEN;
} else {
++text;
}
}
result -= hidden;
}
return result;
}
/*
* if (height or width == -1) Maximize()
* if (height or width == 0), justify and return actual limits.
@ -1074,7 +1137,7 @@ real_auto_size(const char *title,
} else if (prompt != 0) {
wide = MAX(title_length, mincols);
if (strchr(prompt, '\n') == 0) {
double val = dialog_state.aspect_ratio * dlg_count_columns(prompt);
double val = dialog_state.aspect_ratio * count_real_columns(prompt);
double xxx = sqrt(val);
int tmp = (int) xxx;
wide = MAX(wide, tmp);
@ -1190,6 +1253,27 @@ dlg_auto_sizefile(const char *title,
(void) fclose(fd);
}
static chtype
dlg_get_cell_attrs(WINDOW *win)
{
chtype result;
#ifdef USE_WIDE_CURSES
cchar_t wch;
wchar_t cc;
attr_t attrs;
short pair;
if (win_wch(win, &wch) == OK
&& getcchar(&wch, &cc, &attrs, &pair, NULL) == OK) {
result = attrs;
} else {
result = 0;
}
#else
result = winch(win) & (A_ATTRIBUTES & ~A_COLOR);
#endif
return result;
}
/*
* Draw a rectangular box with line drawing characters.
*
@ -1239,53 +1323,220 @@ dlg_draw_box(WINDOW *win, int y, int x, int height, int width,
wattrset(win, save);
}
static DIALOG_WINDOWS *
find_window(WINDOW *win)
{
DIALOG_WINDOWS *result = 0;
DIALOG_WINDOWS *p;
for (p = dialog_state.all_windows; p != 0; p = p->next) {
if (p->normal == win) {
result = p;
break;
}
}
return result;
}
#ifdef HAVE_COLOR
/*
* If we have wchgat(), use that for updating shadow attributes, to work with
* wide-character data.
*/
/*
* Check if the given point is "in" the given window. If so, return the window
* pointer, otherwise null.
*/
static WINDOW *
in_window(WINDOW *win, int y, int x)
{
WINDOW *result = 0;
int y_base = getbegy(win);
int x_base = getbegx(win);
int y_last = getmaxy(win) + y_base;
int x_last = getmaxx(win) + x_base;
if (y >= y_base && y <= y_last && x >= x_base && x <= x_last)
result = win;
return result;
}
static WINDOW *
window_at_cell(DIALOG_WINDOWS * dw, int y, int x)
{
WINDOW *result = 0;
DIALOG_WINDOWS *p;
int y_want = y + getbegy(dw->shadow);
int x_want = x + getbegx(dw->shadow);
for (p = dialog_state.all_windows; p != 0; p = p->next) {
if (dw->normal != p->normal
&& dw->shadow != p->normal
&& (result = in_window(p->normal, y_want, x_want)) != 0) {
break;
}
}
if (result == 0) {
result = stdscr;
}
return result;
}
static bool
in_shadow(WINDOW *normal, WINDOW *shadow, int y, int x)
{
bool result = FALSE;
int ybase = getbegy(normal);
int ylast = getmaxy(normal) + ybase;
int xbase = getbegx(normal);
int xlast = getmaxx(normal) + xbase;
y += getbegy(shadow);
x += getbegx(shadow);
if (y >= ybase + SHADOW_ROWS
&& y < ylast + SHADOW_ROWS
&& x >= xlast
&& x < xlast + SHADOW_COLS) {
/* in the right-side */
result = TRUE;
} else if (y >= ylast
&& y < ylast + SHADOW_ROWS
&& x >= ybase + SHADOW_COLS
&& x < ylast + SHADOW_COLS) {
/* check the bottom */
result = TRUE;
}
return result;
}
/*
* When erasing a shadow, check each cell to make sure that it is not part of
* another box's shadow. This is a little complicated since most shadows are
* merged onto stdscr.
*/
static bool
last_shadow(DIALOG_WINDOWS * dw, int y, int x)
{
DIALOG_WINDOWS *p;
bool result = TRUE;
for (p = dialog_state.all_windows; p != 0; p = p->next) {
if (p->normal != dw->normal
&& in_shadow(p->normal, dw->shadow, y, x)) {
result = FALSE;
break;
}
}
return result;
}
static void
repaint_cell(DIALOG_WINDOWS * dw, bool draw, int y, int x)
{
WINDOW *win = dw->shadow;
WINDOW *cellwin;
int y2, x2;
if ((cellwin = window_at_cell(dw, y, x)) != 0
&& (draw || last_shadow(dw, y, x))
&& (y2 = (y + getbegy(win) - getbegy(cellwin))) >= 0
&& (x2 = (x + getbegx(win) - getbegx(cellwin))) >= 0
&& wmove(cellwin, y2, x2) != ERR) {
chtype the_cell = dlg_get_attrs(cellwin);
chtype the_attr = (draw ? shadow_attr : the_cell);
if (dlg_get_cell_attrs(cellwin) & A_ALTCHARSET) {
the_attr |= A_ALTCHARSET;
}
#if USE_WCHGAT
wchgat(cellwin, 1,
the_attr & (chtype) (~A_COLOR),
PAIR_NUMBER(the_attr),
NULL);
#else
{
chtype the_char = ((winch(cellwin) & A_CHARTEXT) | the_attr);
(void) waddch(cellwin, the_char);
}
#endif
wnoutrefresh(cellwin);
}
}
#define RepaintCell(dw, draw, y, x) repaint_cell(dw, draw, y, x)
static void
repaint_shadow(DIALOG_WINDOWS * dw, bool draw, int y, int x, int height, int width)
{
int i, j;
if (UseShadow(dw)) {
#if !USE_WCHGAT
chtype save = dlg_get_attrs(dw->shadow);
wattrset(dw->shadow, draw ? shadow_attr : screen_attr);
#endif
for (i = 0; i < SHADOW_ROWS; ++i) {
for (j = 0; j < width; ++j) {
RepaintCell(dw, draw, i + y + height, j + x + SHADOW_COLS);
}
}
for (i = 0; i < height; i++) {
for (j = 0; j < SHADOW_COLS; ++j) {
RepaintCell(dw, draw, i + y + SHADOW_ROWS, j + x + width);
}
}
(void) wnoutrefresh(dw->shadow);
#if !USE_WCHGAT
wattrset(dw->shadow, save);
#endif
}
}
/*
* Draw a shadow on the parent window corresponding to the right- and
* bottom-edge of the child window, to give a 3-dimensional look.
*/
static void
draw_childs_shadow(WINDOW *parent, WINDOW *child)
draw_childs_shadow(DIALOG_WINDOWS * dw)
{
if (has_colors()) { /* Whether terminal supports color? */
chtype save = dlg_get_attrs(parent);
if (UseShadow(dw)) {
repaint_shadow(dw,
TRUE,
getbegy(dw->normal) - getbegy(dw->shadow),
getbegx(dw->normal) - getbegx(dw->shadow),
getmaxy(dw->normal),
getmaxx(dw->normal));
}
}
dlg_draw_shadow(parent,
getbegy(child) - getbegy(parent),
getbegx(child) - getbegx(parent),
getmaxy(child),
getmaxx(child));
wattrset(parent, save);
/*
* Erase a shadow on the parent window corresponding to the right- and
* bottom-edge of the child window.
*/
static void
erase_childs_shadow(DIALOG_WINDOWS * dw)
{
if (UseShadow(dw)) {
repaint_shadow(dw,
FALSE,
getbegy(dw->normal) - getbegy(dw->shadow),
getbegx(dw->normal) - getbegx(dw->shadow),
getmaxy(dw->normal),
getmaxx(dw->normal));
}
}
/*
* Draw shadows along the right and bottom edge to give a more 3D look
* to the boxes
* to the boxes.
*/
void
dlg_draw_shadow(WINDOW *win, int y, int x, int height, int width)
{
int i, j;
if (has_colors()) { /* Whether terminal supports color? */
wattrset(win, shadow_attr);
for (i = 0; i < SHADOW_ROWS; ++i) {
for (j = 0; j < width; ++j) {
if (wmove(win, i + y + height, j + x + SHADOW_COLS) != ERR) {
(void) waddch(win, winch(win) & (chtype) (~A_COLOR));
}
}
}
for (i = 0; i < height; i++) {
for (j = 0; j < SHADOW_COLS; ++j) {
if (wmove(win, i + y + SHADOW_ROWS, j + x + width) != ERR) {
(void) waddch(win, winch(win) & (chtype) (~A_COLOR));
}
}
}
(void) wnoutrefresh(win);
}
repaint_shadow(find_window(win), TRUE, y, x, height, width);
}
#endif /* HAVE_COLOR */
@ -1340,6 +1591,10 @@ dlg_exit(int code)
code = DLG_EXIT_HELP;
goto retry;
}
#ifdef HAVE_DLG_TRACE
dlg_trace((const char *) 0); /* close it */
#endif
#ifdef NO_LEAKS
_dlg_inputstr_leaks();
#if defined(NCURSES_VERSION) && defined(HAVE__NC_FREE_AND_EXIT)
@ -1650,6 +1905,8 @@ dlg_del_window(WINDOW *win)
}
if (q) {
if (dialog_state.all_windows != 0)
erase_childs_shadow(q);
delwin(q->normal);
dlg_unregister_window(q->normal);
free(q);
@ -1663,26 +1920,13 @@ dlg_del_window(WINDOW *win)
WINDOW *
dlg_new_window(int height, int width, int y, int x)
{
WINDOW *win;
DIALOG_WINDOWS *p = dlg_calloc(DIALOG_WINDOWS, 1);
if ((win = newwin(height, width, y, x)) == 0) {
dlg_exiterr("Can't make new window at (%d,%d), size (%d,%d).\n",
y, x, height, width);
}
p->next = dialog_state.all_windows;
p->normal = win;
dialog_state.all_windows = p;
#ifdef HAVE_COLOR
if (dialog_state.use_shadow) {
draw_childs_shadow(p->shadow = stdscr, win);
}
#endif
(void) keypad(win, TRUE);
return win;
return dlg_new_modal_window(stdscr, height, width, y, x);
}
/*
* "Modal" windows differ from normal ones by having a shadow in a window
* separate from the standard screen.
*/
WINDOW *
dlg_new_modal_window(WINDOW *parent, int height, int width, int y, int x)
{
@ -1699,7 +1943,8 @@ dlg_new_modal_window(WINDOW *parent, int height, int width, int y, int x)
dialog_state.all_windows = p;
#ifdef HAVE_COLOR
if (dialog_state.use_shadow) {
draw_childs_shadow(p->shadow = parent, win);
p->shadow = parent;
draw_childs_shadow(p);
}
#endif
@ -1714,19 +1959,12 @@ dlg_new_modal_window(WINDOW *parent, int height, int width, int y, int x)
void
dlg_move_window(WINDOW *win, int height, int width, int y, int x)
{
DIALOG_WINDOWS *p, *q;
DIALOG_WINDOWS *p;
if (win != 0) {
dlg_ctl_size(height, width);
for (p = dialog_state.all_windows; p != 0; p = q) {
q = p->next;
if (p->normal == win) {
break;
}
}
if (p != 0) {
if ((p = find_window(win)) != 0) {
(void) wresize(win, height, width);
(void) mvwin(win, y, x);
#ifdef HAVE_COLOR
@ -1741,8 +1979,7 @@ dlg_move_window(WINDOW *win, int height, int width, int y, int x)
(void) refresh();
#ifdef HAVE_COLOR
if (p->shadow)
draw_childs_shadow(p->shadow, win);
draw_childs_shadow(p);
#endif
}
}
@ -1883,7 +2120,7 @@ dlg_trim_string(char *s)
char *base = s;
char *p1;
char *p = s;
int has_newlines = (strstr(s, "\\n") != 0);
int has_newlines = !dialog_vars.no_nl_expand && (strstr(s, "\\n") != 0);
while (*p != '\0') {
if (*p == TAB && !dialog_vars.nocollapse)

View File

@ -1,9 +1,9 @@
/*
* $Id: yesno.c,v 1.49 2010/01/15 10:54:54 tom Exp $
* $Id: yesno.c,v 1.51 2011/06/27 08:20:57 tom Exp $
*
* yesno.c -- implements the yes/no box
*
* Copyright 1999-2009,2010 Thomas E. Dickey
* Copyright 1999-2010,2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@ -35,6 +35,7 @@ dialog_yesno(const char *title, const char *cprompt, int height, int width)
{
/* *INDENT-OFF* */
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ),
@ -89,6 +90,7 @@ dialog_yesno(const char *title, const char *cprompt, int height, int width)
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
dlg_draw_bottom_box(dialog);
dlg_draw_title(dialog, title);
dlg_draw_helpline(dialog, FALSE);
wattrset(dialog, dialog_attr);