mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-05 12:56:08 +00:00
Update dialog to 1.2-20130523
This commit is contained in:
parent
5f120a342b
commit
c1ba58ff2b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/dialog/dist/; revision=251839 svn path=/vendor/dialog/1.2-20130523/; revision=251840; tag=vendor/dialog/1.2-20130523
104
CHANGES
104
CHANGES
@ -1,9 +1,66 @@
|
||||
-- $Id: CHANGES,v 1.419 2012/07/06 18:18:48 tom Exp $
|
||||
-- $Id: CHANGES,v 1.458 2013/05/24 00:23:22 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:
|
||||
|
||||
2013/05/23
|
||||
+ modify ifdef in arrows.c to work around packages which use the
|
||||
wide-character ncursesw headers with the ncurses library (report
|
||||
by Aleksey Cheusov).
|
||||
+ correct workaround for xterm alternate-screen to work with/without
|
||||
the fix made in ncurses that makes putp() always write to the
|
||||
standard output (Debian #708829).
|
||||
+ improve limit-checks for checklist, in case the dialog is resized
|
||||
(report by Ilya A Arkhipov).
|
||||
+ add --last-key option (adapted from patch by Jordi Pujol, Debian
|
||||
#697607).
|
||||
|
||||
2013/03/15
|
||||
+ update zh_TW.po, add an.po from
|
||||
http://translationproject.org/latest/dialog/
|
||||
|
||||
2012/12/30 - release 1.2
|
||||
+ improve some older changelog entries to help with HTML'izing content.
|
||||
+ various fixes/improvments for scrollbar appearance.
|
||||
+ add mappings for some equivalent options provided by whiptail;
|
||||
add configure option --disable-whiptail to allow suppressing these.
|
||||
+ add configure option --disable-Xdialog2 to allow suppressing the
|
||||
newer features, i.e., for cdialog 1.2
|
||||
+ add --no-items option, for consistency.
|
||||
+ add --no-tags option, like Xdialog.
|
||||
+ add buildlist, rangebox and treeview dialogs, like Xdialog.
|
||||
+ remove obsolete workaround for ncurses 4.2 scrolling in checklist
|
||||
and menubox.
|
||||
+ improve dialog_helpfile() by preventing it from showing extra buttons
|
||||
(suggested by xDog Walker).
|
||||
+ correct logic in formbox's scroll_next() function (report by xDog
|
||||
Walker).
|
||||
+ fix a case with inputbox widget where preset input text is not shown
|
||||
until moving the cursor within the text (report by xDog Walker).
|
||||
+ handle SIGCHLD in dialog_prgbox() to eliminate defunct processes
|
||||
(report by xDog Walker).
|
||||
+ improve the way "hotkeys" are assigned to widget buttons by checking
|
||||
if a given key has already been used in the row of buttons (Debian
|
||||
#684933).
|
||||
+ amend fix for --trace parsing from 2012/07/03, which sometimes
|
||||
skipped a parameter (report by xDog Walker).
|
||||
+ drop copismall and install files from samples, which were essentially
|
||||
nonfunctional.
|
||||
+ correct secondary border colors in samples/slackware.rc and
|
||||
samples/whiptail.rc
|
||||
+ update gl.po, add ia.po from
|
||||
http://translationproject.org/latest/dialog/
|
||||
+ fix various issues reported by coverity scan.
|
||||
+ miscellaneous configure script fixes/updates:
|
||||
+ require autoconf 2.52+patches
|
||||
+ support --datarootdir option
|
||||
+ check for clang compiler
|
||||
+ check for tinfo library when looking for ncurses
|
||||
+ add 3rd parameter to AC_DEFINE for autoheader
|
||||
+ remove unused macros from aclocal.m4
|
||||
+ update config.guess, config.sub
|
||||
|
||||
2012/07/06
|
||||
+ modify samples/setup-tempfile to work with Tru64's shell.
|
||||
+ modify inputmenu sample scripts to make them more portable:
|
||||
@ -558,7 +615,8 @@ to it:
|
||||
+ use $(INSTALL_SCRIPT) for installing dialog-config (report by
|
||||
Santiago Vila).
|
||||
|
||||
2007/02/27
|
||||
2007/02/27 - release 1.1
|
||||
+ mark as "dialog 1.1"
|
||||
+ add dialog-config script, which provides applications with compile-
|
||||
and link-information for using the dialog library.
|
||||
+ move calls to dlg_trim_string() out of loop in dialog.c, so each
|
||||
@ -791,8 +849,7 @@ to it:
|
||||
+ modify tailboxbg by resetting tty modes at the point where it forks a
|
||||
process to update the screen, rather than waiting until that process
|
||||
exits. This improves user feedback by making it apparent that dialog
|
||||
is no longer processing input after that point (Redhat Bugzilla
|
||||
#142538).
|
||||
is no longer processing input after that point (Redhat #142538).
|
||||
+ minor updates to some .po files using Babel Fish, comparing with lynx.
|
||||
+ update es.po (Santiago Vila).
|
||||
+ work around bug in NetBSD 1.6 curses which seems to be confused by
|
||||
@ -978,8 +1035,7 @@ to it:
|
||||
before dialog is invoked (Debian #244746).
|
||||
+ correct dlg_match_char() function, which was broken during rewrite
|
||||
to support wide-characters (Debian #244777).
|
||||
+ improved ru.po, uses UTF-8 charset (Leonid Kanter, Redhat Bugzilla
|
||||
#119200).
|
||||
+ improved ru.po, uses UTF-8 charset (Leonid Kanter, Redhat #119200).
|
||||
+ correct position of shadow drawn for dialogs, which appeared to work
|
||||
for most versions of curses (other than NetBSD) but would have been
|
||||
visible for certain color schemes (discussion with Julian Coleman).
|
||||
@ -1310,7 +1366,7 @@ to it:
|
||||
the --stdout option does not work on HPUX but otherwise dialog works.
|
||||
+ updated el.po (patch by kromJx <kromJx@crosswinds.net>).
|
||||
|
||||
2002/05/19
|
||||
2002/05/19 - release 0.9b
|
||||
+ add --no-collapse option to allow one to retain tabs and repeated
|
||||
blanks in a message box (request by Roberto Simoni).
|
||||
+ use DLG_EXIT_ESC constant rather than -1's in several places. This
|
||||
@ -1778,15 +1834,15 @@ to it:
|
||||
Santiago Vila <sanvila@ctv.es>:
|
||||
|
||||
1999/10/07
|
||||
+ add a password dialog box.
|
||||
+ add a password dialog box (Debian #45964, patch by Joey Hess).
|
||||
+ implement "--defaultno" option to specify if the default for
|
||||
the yes/no box is "No".
|
||||
the yes/no box is "No" (Debian #46076, patch by Joey Hess).
|
||||
1999/03/10
|
||||
+ modify input.c to clear the input field to the right of the
|
||||
given string (unclear: this seems redundant, since the
|
||||
dialog is drawn in a new window).
|
||||
given string, to help with screen-refresh
|
||||
1998/12/08
|
||||
+ check for list_height less than one in checklist.c
|
||||
+ check for list_height less than one in checklist.c (Debian
|
||||
#22239).
|
||||
1998/10/21
|
||||
+ use function wscrl() in preference to scroll() in checklist.c
|
||||
and menubox.c (unclear: in ncurses, scroll() is a macro that
|
||||
@ -1796,12 +1852,14 @@ to it:
|
||||
that directory.
|
||||
1998/09/12
|
||||
+ simplify menubox.c using new functions print_arrows() and
|
||||
print_items().
|
||||
+ add logic to handle KEY_NPAGE and KEY_PPAGE.
|
||||
+ change sample scripts to use Debian tempfile utility rather
|
||||
than putting files into /tmp.
|
||||
+ change sample scripts to use 'dialog' from user's path rather
|
||||
than in the parent directory as in the build directory.
|
||||
print_items(). add logic to handle KEY_NPAGE and KEY_PPAGE
|
||||
(Debian #26326).
|
||||
+ modifications to provide sample scripts (Debian #26211):
|
||||
+ change sample scripts to use Debian tempfile utility rather
|
||||
than putting files into /tmp.
|
||||
+ change sample scripts to use 'dialog' from user's path
|
||||
rather than in the parent directory as in the build
|
||||
directory.
|
||||
+ use the system copy of GPL rather than that in the build
|
||||
directory as an example for the textbox script.
|
||||
|
||||
@ -1827,16 +1885,16 @@ The relevant portions of the Debian change log for the original version
|
||||
1998/05/24
|
||||
|
||||
+ Replaced guage.c by the one in dialog 0.6z, which is known to work.
|
||||
Fixes Bug #18284: unstable dialog.
|
||||
Fixes Debian #18284: unstable dialog.
|
||||
|
||||
1997/12/16
|
||||
|
||||
+ dialog.c: dialog_input_result printed with "%s" format. This was
|
||||
Bug #9913, fixed by Bill Mitchell, but the change was lost.
|
||||
Debian #9913, fixed by Bill Mitchell, but the change was lost.
|
||||
+ Pristine source, .depend is not removed in clean target. Instead, it
|
||||
is made zero lenght (otherwise it would not work *without* fakeroot).
|
||||
+ Added '^U' support in input box (Bug #9915, patch by joey@debian.org).
|
||||
+ Wrote patch to fix core-dumping problem (Bug #13170). Sven Rudolph
|
||||
is made zero length (otherwise it would not work *without* fakeroot).
|
||||
+ Added '^U' support in input box (Debian #9915, patch by Joey Hess).
|
||||
+ Wrote patch to fix core-dumping problem (Debian #13170). Sven Rudolph
|
||||
<sr1@inf.tu-dresden.de>:
|
||||
|
||||
-- vile:fk=8bit
|
||||
|
476
aclocal.m4
vendored
476
aclocal.m4
vendored
@ -1,5 +1,5 @@
|
||||
dnl macros used for DIALOG configure script
|
||||
dnl $Id: aclocal.m4,v 1.87 2012/02/16 02:11:26 tom Exp $
|
||||
dnl $Id: aclocal.m4,v 1.90 2012/12/02 20:07:30 tom Exp $
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Copyright 1999-2011,2012 -- Thomas E. Dickey
|
||||
dnl
|
||||
@ -31,23 +31,21 @@ dnl see
|
||||
dnl http://invisible-island.net/autoconf/
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl AM_GNU_GETTEXT version: 12 updated: 2010/06/19 07:02:11
|
||||
dnl AM_GNU_GETTEXT version: 13 updated: 2012/11/09 05:47:26
|
||||
dnl --------------
|
||||
dnl Usage: Just like AM_WITH_NLS, which see.
|
||||
AC_DEFUN([AM_GNU_GETTEXT],
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
AC_REQUIRE([jm_GLIBC21])dnl
|
||||
AC_REQUIRE([CF_PROG_CC])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
|
||||
stdlib.h string.h unistd.h sys/param.h])
|
||||
@ -282,7 +280,7 @@ fi
|
||||
AC_SUBST($1)dnl
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl AM_WITH_NLS version: 24 updated: 2010/06/20 09:24:28
|
||||
dnl AM_WITH_NLS version: 25 updated: 2012/10/06 08:57:51
|
||||
dnl -----------
|
||||
dnl Inserted as requested by gettext 0.10.40
|
||||
dnl File from /usr/share/aclocal
|
||||
@ -385,7 +383,7 @@ AC_DEFUN([AM_WITH_NLS],
|
||||
LIBS="$cf_save_LIBS_1"
|
||||
|
||||
if test "$cf_cv_func_gettext" = yes ; then
|
||||
AC_DEFINE(HAVE_LIBINTL_H)
|
||||
AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have libintl.h])
|
||||
|
||||
dnl If an already present or preinstalled GNU gettext() is found,
|
||||
dnl use it. But if this macro is used in GNU gettext, and GNU
|
||||
@ -592,14 +590,14 @@ changequote([,])dnl
|
||||
AC_SUBST(GENCAT)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_ACVERSION_CHECK version: 2 updated: 2011/05/08 11:22:03
|
||||
dnl CF_ACVERSION_CHECK version: 3 updated: 2012/10/03 18:39:53
|
||||
dnl ------------------
|
||||
dnl Conditionally generate script according to whether we're using a given autoconf.
|
||||
dnl
|
||||
dnl $1 = version to compare against
|
||||
dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
|
||||
dnl $3 = code to use if AC_ACVERSION is older than $1.
|
||||
define(CF_ACVERSION_CHECK,
|
||||
define([CF_ACVERSION_CHECK],
|
||||
[
|
||||
ifdef([m4_version_compare],
|
||||
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
|
||||
@ -607,26 +605,16 @@ ifdef([m4_version_compare],
|
||||
AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
|
||||
AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_ACVERSION_COMPARE version: 2 updated: 2011/04/14 20:56:50
|
||||
dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
|
||||
dnl --------------------
|
||||
dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
|
||||
dnl MAJOR2, MINOR2, TERNARY2,
|
||||
dnl PRINTABLE2, not FOUND, FOUND)
|
||||
define(CF_ACVERSION_COMPARE,
|
||||
define([CF_ACVERSION_COMPARE],
|
||||
[ifelse(builtin([eval], [$2 < $5]), 1,
|
||||
[ifelse([$8], , ,[$8])],
|
||||
[ifelse([$9], , ,[$9])])])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_AC_PREREQ version: 2 updated: 1997/09/06 13:24:56
|
||||
dnl ------------
|
||||
dnl Conditionally generate script according to whether we're using the release
|
||||
dnl version of autoconf, or a patched version (using the ternary component as
|
||||
dnl the patch-version).
|
||||
define(CF_AC_PREREQ,
|
||||
[CF_PREREQ_COMPARE(
|
||||
AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)),
|
||||
AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1], [$2], [$3])])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
|
||||
dnl -------------
|
||||
dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
|
||||
@ -901,12 +889,6 @@ dnl Allow user to disable a normally-on option.
|
||||
AC_DEFUN([CF_ARG_DISABLE],
|
||||
[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
|
||||
dnl -------------
|
||||
dnl Allow user to enable a normally-off option.
|
||||
AC_DEFUN([CF_ARG_ENABLE],
|
||||
[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_ARG_MSG_ENABLE version: 2 updated: 2000/07/29 19:32:03
|
||||
dnl -----------------
|
||||
dnl Verbose form of AC_ARG_ENABLE:
|
||||
@ -952,7 +934,7 @@ ifelse([$3],,[ :]dnl
|
||||
])dnl
|
||||
])])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_BUNDLED_INTL version: 16 updated: 2010/10/23 15:55:05
|
||||
dnl CF_BUNDLED_INTL version: 17 updated: 2012/10/06 08:57:51
|
||||
dnl ---------------
|
||||
dnl Top-level macro for configuring an application with a bundled copy of
|
||||
dnl the intl and po directories for gettext.
|
||||
@ -1009,7 +991,7 @@ if test "$USE_NLS" = yes ; then
|
||||
[ --with-textdomain=PKG NLS text-domain (default is package name)],
|
||||
[NLS_TEXTDOMAIN=$withval],
|
||||
[NLS_TEXTDOMAIN=$PACKAGE])
|
||||
AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN")
|
||||
AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN",[Define to the nls textdomain value])
|
||||
AC_SUBST(NLS_TEXTDOMAIN)
|
||||
fi
|
||||
|
||||
@ -1029,7 +1011,7 @@ if test "$USE_INCLUDED_LIBINTL" = yes ; then
|
||||
INTLDIR_MAKE="#"
|
||||
fi
|
||||
if test -z "$INTLDIR_MAKE"; then
|
||||
AC_DEFINE(HAVE_LIBGETTEXT_H)
|
||||
AC_DEFINE(HAVE_LIBGETTEXT_H,1,[Define to 1 if we have libgettext.h])
|
||||
for cf_makefile in \
|
||||
$srcdir/intl/Makefile.in \
|
||||
$srcdir/intl/makefile.in
|
||||
@ -1072,17 +1054,43 @@ dnl own code, except ENABLE_NLS, which is too vague to be of any use.
|
||||
|
||||
if test "$USE_INCLUDED_LIBINTL" = yes ; then
|
||||
if test "$nls_cv_force_use_gnu_gettext" = yes ; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
|
||||
elif test "$nls_cv_use_gnu_gettext" = yes ; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
|
||||
fi
|
||||
if test -n "$nls_cv_header_intl" ; then
|
||||
AC_DEFINE(HAVE_LIBINTL_H)
|
||||
AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have header-file for libintl])
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
|
||||
dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
|
||||
dnl ---------------
|
||||
dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
|
||||
dnl into CC. This will not help with broken scripts that wrap the compiler with
|
||||
dnl options, but eliminates a more common category of user confusion.
|
||||
AC_DEFUN([CF_CC_ENV_FLAGS],
|
||||
[
|
||||
# This should have been defined by AC_PROG_CC
|
||||
: ${CC:=cc}
|
||||
|
||||
AC_MSG_CHECKING(\$CC variable)
|
||||
case "$CC" in #(vi
|
||||
*[[\ \ ]]-[[IUD]]*)
|
||||
AC_MSG_RESULT(broken)
|
||||
AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
|
||||
# humor him...
|
||||
cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'`
|
||||
CC=`echo "$CC" | sed -e 's/[[ ]].*//'`
|
||||
CF_ADD_CFLAGS($cf_flags)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(ok)
|
||||
;;
|
||||
esac
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
|
||||
dnl --------------
|
||||
dnl Check if we're accidentally using a cache from a different machine.
|
||||
dnl Derive the system name, as a check for reusing the autoconf cache.
|
||||
@ -1105,7 +1113,7 @@ else
|
||||
system_name="`(hostname) 2>/dev/null`"
|
||||
fi
|
||||
fi
|
||||
test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
|
||||
test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
|
||||
AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
|
||||
|
||||
test -z "$system_name" && system_name="$cf_cv_system_name"
|
||||
@ -1117,7 +1125,40 @@ if test ".$system_name" != ".$cf_cv_system_name" ; then
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CURSES_CHTYPE version: 7 updated: 2010/10/23 15:54:49
|
||||
dnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39
|
||||
dnl -----------------
|
||||
dnl Check if the given compiler is really clang. clang's C driver defines
|
||||
dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
|
||||
dnl not ignore some gcc options.
|
||||
dnl
|
||||
dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
|
||||
dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
|
||||
dnl the wrappers for gcc and g++ warnings.
|
||||
dnl
|
||||
dnl $1 = GCC (default) or GXX
|
||||
dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
|
||||
dnl $3 = CFLAGS (default) or CXXFLAGS
|
||||
AC_DEFUN([CF_CLANG_COMPILER],[
|
||||
ifelse([$2],,CLANG_COMPILER,[$2])=no
|
||||
|
||||
if test "$ifelse([$1],,[$1],GCC)" = yes ; then
|
||||
AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
|
||||
cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
|
||||
ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
|
||||
AC_TRY_COMPILE([],[
|
||||
#ifdef __clang__
|
||||
#else
|
||||
make an error
|
||||
#endif
|
||||
],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
|
||||
cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
|
||||
],[])
|
||||
ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
|
||||
AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
|
||||
fi
|
||||
])
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CURSES_CHTYPE version: 8 updated: 2012/10/06 08:57:51
|
||||
dnl ----------------
|
||||
dnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses).
|
||||
AC_DEFUN([CF_CURSES_CHTYPE],
|
||||
@ -1129,14 +1170,14 @@ AC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[
|
||||
[cf_cv_chtype_decl=yes],
|
||||
[cf_cv_chtype_decl=no])])
|
||||
if test $cf_cv_chtype_decl = yes ; then
|
||||
AC_DEFINE(HAVE_TYPE_CHTYPE)
|
||||
AC_DEFINE(HAVE_TYPE_CHTYPE,1,[Define to 1 if chtype is declared])
|
||||
AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[
|
||||
AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
|
||||
[chtype foo; long x = foo],
|
||||
[cf_cv_chtype_type=scalar],
|
||||
[cf_cv_chtype_type=struct])])
|
||||
if test $cf_cv_chtype_type = scalar ; then
|
||||
AC_DEFINE(TYPE_CHTYPE_IS_SCALAR)
|
||||
AC_DEFINE(TYPE_CHTYPE_IS_SCALAR,1,[Define to 1 if chtype is a scaler/integer])
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
@ -1252,7 +1293,7 @@ fi
|
||||
AC_CHECK_HEADERS($cf_cv_ncurses_header)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CURSES_LIBS version: 35 updated: 2011/08/09 21:06:37
|
||||
dnl CF_CURSES_LIBS version: 36 updated: 2012/07/07 21:02:48
|
||||
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.
|
||||
@ -1332,7 +1373,7 @@ if test ".$ac_cv_func_initscr" != .yes ; then
|
||||
# Check for library containing tgoto. Do this before curses library
|
||||
# because it may be needed to link the test-case for initscr.
|
||||
AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
|
||||
for cf_term_lib in $cf_check_list otermcap termcap termlib unknown
|
||||
for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
|
||||
do
|
||||
AC_CHECK_LIB($cf_term_lib,tgoto,[break])
|
||||
done
|
||||
@ -1376,7 +1417,7 @@ fi
|
||||
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CURSES_TERM_H version: 9 updated: 2011/04/09 18:19:55
|
||||
dnl CF_CURSES_TERM_H version: 10 updated: 2012/10/06 08:57:51
|
||||
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,
|
||||
@ -1435,18 +1476,18 @@ esac
|
||||
|
||||
case $cf_cv_term_header in #(vi
|
||||
term.h) #(vi
|
||||
AC_DEFINE(HAVE_TERM_H)
|
||||
AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
|
||||
;;
|
||||
ncurses/term.h) #(vi
|
||||
AC_DEFINE(HAVE_NCURSES_TERM_H)
|
||||
AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
|
||||
;;
|
||||
ncursesw/term.h)
|
||||
AC_DEFINE(HAVE_NCURSESW_TERM_H)
|
||||
AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
|
||||
;;
|
||||
esac
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CURSES_UNCTRL_H version: 1 updated: 2011/04/09 18:19:55
|
||||
dnl CF_CURSES_UNCTRL_H version: 2 updated: 2012/10/06 08:57:51
|
||||
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
|
||||
@ -1490,18 +1531,18 @@ esac
|
||||
|
||||
case $cf_cv_unctrl_header in #(vi
|
||||
unctrl.h) #(vi
|
||||
AC_DEFINE(HAVE_UNCTRL_H)
|
||||
AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h])
|
||||
;;
|
||||
ncurses/unctrl.h) #(vi
|
||||
AC_DEFINE(HAVE_NCURSES_UNCTRL_H)
|
||||
AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h])
|
||||
;;
|
||||
ncursesw/unctrl.h)
|
||||
AC_DEFINE(HAVE_NCURSESW_UNCTRL_H)
|
||||
AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h])
|
||||
;;
|
||||
esac
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59
|
||||
dnl CF_CURSES_WACS_MAP version: 6 updated: 2012/10/06 08:57:51
|
||||
dnl ------------------
|
||||
dnl Check for likely values of wacs_map[].
|
||||
AC_DEFUN([CF_CURSES_WACS_MAP],
|
||||
@ -1520,10 +1561,10 @@ AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
|
||||
break])
|
||||
done])
|
||||
|
||||
test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map)
|
||||
test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map,[Define to name of (n)curses wide-character array])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CURSES_WACS_SYMBOLS version: 1 updated: 2011/01/15 11:28:59
|
||||
dnl CF_CURSES_WACS_SYMBOLS version: 2 updated: 2012/10/06 08:57:51
|
||||
dnl ----------------------
|
||||
dnl Do a check to see if the WACS_xxx constants are defined compatibly with
|
||||
dnl X/Open Curses. In particular, NetBSD's implementation of the WACS_xxx
|
||||
@ -1555,10 +1596,10 @@ else
|
||||
fi
|
||||
])
|
||||
|
||||
test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS)
|
||||
test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS,1,[Define to 1 if (n)curses supports wide-character WACS_ symbols])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_CURSES_WGETPARENT version: 2 updated: 2011/10/17 20:12:04
|
||||
dnl CF_CURSES_WGETPARENT version: 3 updated: 2012/10/06 08:57:51
|
||||
dnl --------------------
|
||||
dnl Check for curses support for directly determining the parent of a given
|
||||
dnl window. Some implementations make this difficult, so we provide for
|
||||
@ -1577,7 +1618,7 @@ then
|
||||
AC_MSG_RESULT($cf_window__parent)
|
||||
if test "$cf_window__parent" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_WINDOW__PARENT)
|
||||
AC_DEFINE(HAVE_WINDOW__PARENT,1,[Define to 1 if WINDOW struct has _parent member])
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
@ -1587,7 +1628,7 @@ dnl ----------
|
||||
dnl "dirname" is not portable, so we fake it with a shell script.
|
||||
AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57
|
||||
dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
|
||||
dnl ---------------
|
||||
dnl You can always use "make -n" to see the actual options, but it's hard to
|
||||
dnl pick out/analyze warning messages when the compile-line is long.
|
||||
@ -1602,7 +1643,7 @@ dnl
|
||||
AC_DEFUN([CF_DISABLE_ECHO],[
|
||||
AC_MSG_CHECKING(if you want to see long compiling messages)
|
||||
CF_ARG_DISABLE(echo,
|
||||
[ --disable-echo display "compiling" commands],
|
||||
[ --disable-echo do not display "compiling" commands],
|
||||
[
|
||||
ECHO_LT='--silent'
|
||||
ECHO_LD='@echo linking [$]@;'
|
||||
@ -1667,38 +1708,6 @@ if test "$cf_disable_rpath_hack" = no ; then
|
||||
fi
|
||||
])
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_FIND_HEADER version: 2 updated: 2007/07/29 11:32:00
|
||||
dnl --------------
|
||||
dnl Find a header file, searching for it if it is not already in the include
|
||||
dnl path.
|
||||
dnl
|
||||
dnl $1 = the header filename
|
||||
dnl $2 = the package name
|
||||
dnl $3 = action to perform if successful
|
||||
dnl $4 = action to perform if not successful
|
||||
AC_DEFUN([CF_FIND_HEADER],[
|
||||
AC_CHECK_HEADER([$1],
|
||||
cf_find_header=yes,[
|
||||
cf_find_header=no
|
||||
CF_HEADER_PATH(cf_search,$2)
|
||||
for cf_incdir in $cf_search
|
||||
do
|
||||
if test -f $cf_incdir/$1 ; then
|
||||
CF_ADD_INCDIR($cf_incdir)
|
||||
CF_VERBOSE(... found in $cf_incdir)
|
||||
cf_find_header=yes
|
||||
break
|
||||
fi
|
||||
CF_VERBOSE(... tested $cf_incdir)
|
||||
done
|
||||
])
|
||||
if test "$cf_find_header" = yes ; then
|
||||
ifelse([$3],,:,[$3])
|
||||
ifelse([$4],,,[else
|
||||
$4])
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
|
||||
dnl ---------------
|
||||
dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
|
||||
@ -1879,7 +1888,7 @@ ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_FUNC_WAIT version: 2 updated: 1997/10/21 19:45:33
|
||||
dnl CF_FUNC_WAIT version: 3 updated: 2012/10/06 08:57:51
|
||||
dnl ------------
|
||||
dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'
|
||||
dnl and/or 'waitpid()'.
|
||||
@ -1904,7 +1913,7 @@ if test $cf_cv_type_unionwait = yes; then
|
||||
[cf_cv_arg_union_wait=no])
|
||||
])
|
||||
AC_MSG_RESULT($cf_cv_arg_union_wait)
|
||||
test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION)
|
||||
test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION,1,[Define to 1 if wait() uses a union parameter])
|
||||
|
||||
AC_MSG_CHECKING(if union wait can be used as waitpid-arg)
|
||||
AC_CACHE_VAL(cf_cv_arg_union_waitpid,[
|
||||
@ -1914,12 +1923,12 @@ if test $cf_cv_type_unionwait = yes; then
|
||||
[cf_cv_arg_union_waitpid=no])
|
||||
])
|
||||
AC_MSG_RESULT($cf_cv_arg_union_waitpid)
|
||||
test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION)
|
||||
test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION,1,[Define to 1 if waitpid() uses a union parameter])
|
||||
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32
|
||||
dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
|
||||
dnl -----------------
|
||||
dnl Test for availability of useful gcc __attribute__ directives to quiet
|
||||
dnl compiler warnings. Though useful, not all are supported -- and contrary
|
||||
@ -1997,27 +2006,27 @@ EOF
|
||||
test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
|
||||
cat conftest.h >>confdefs.h
|
||||
case $cf_attribute in #(vi
|
||||
noreturn) #(vi
|
||||
AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
|
||||
;;
|
||||
printf) #(vi
|
||||
if test "$cf_printf_attribute" = no ; then
|
||||
cat >>confdefs.h <<EOF
|
||||
#define GCC_PRINTFLIKE(fmt,var) /* nothing */
|
||||
EOF
|
||||
else
|
||||
cat >>confdefs.h <<EOF
|
||||
#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
|
||||
EOF
|
||||
cf_value='/* nothing */'
|
||||
if test "$cf_printf_attribute" != no ; then
|
||||
cf_value='__attribute__((format(printf,fmt,var)))'
|
||||
AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
|
||||
;;
|
||||
scanf) #(vi
|
||||
if test "$cf_scanf_attribute" = no ; then
|
||||
cat >>confdefs.h <<EOF
|
||||
#define GCC_SCANFLIKE(fmt,var) /* nothing */
|
||||
EOF
|
||||
else
|
||||
cat >>confdefs.h <<EOF
|
||||
#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
|
||||
EOF
|
||||
cf_value='/* nothing */'
|
||||
if test "$cf_scanf_attribute" != no ; then
|
||||
cf_value='__attribute__((format(scanf,fmt,var)))'
|
||||
AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
|
||||
;;
|
||||
unused) #(vi
|
||||
AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
@ -2029,7 +2038,7 @@ rm -rf conftest*
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
|
||||
dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
|
||||
dnl --------------
|
||||
dnl Find version of gcc
|
||||
AC_DEFUN([CF_GCC_VERSION],[
|
||||
@ -2037,13 +2046,13 @@ AC_REQUIRE([AC_PROG_CC])
|
||||
GCC_VERSION=none
|
||||
if test "$GCC" = yes ; then
|
||||
AC_MSG_CHECKING(version of $CC)
|
||||
GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
|
||||
GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
|
||||
test -z "$GCC_VERSION" && GCC_VERSION=unknown
|
||||
AC_MSG_RESULT($GCC_VERSION)
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32
|
||||
dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
|
||||
dnl ---------------
|
||||
dnl Check if the compiler supports useful warning options. There's a few that
|
||||
dnl we don't use, simply because they're too noisy:
|
||||
@ -2066,6 +2075,7 @@ AC_DEFUN([CF_GCC_WARNINGS],
|
||||
[
|
||||
AC_REQUIRE([CF_GCC_VERSION])
|
||||
CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
|
||||
CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line __oline__ "${as_me:-configure}"
|
||||
@ -2141,6 +2151,13 @@ then
|
||||
continue;;
|
||||
esac
|
||||
;;
|
||||
Wpointer-arith) #(vi
|
||||
case $GCC_VERSION in
|
||||
[[12]].*)
|
||||
CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
|
||||
continue;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
|
||||
fi
|
||||
@ -2239,77 +2256,6 @@ test -d "$oldincludedir" && {
|
||||
$1="[$]$1 $cf_header_path_list"
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
|
||||
dnl ---------------
|
||||
dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
|
||||
AC_DEFUN([CF_HELP_MESSAGE],
|
||||
[AC_DIVERT_HELP([$1])dnl
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40
|
||||
dnl ---------------
|
||||
dnl Construct the list of include-options according to whether we're building
|
||||
dnl in the source directory or using '--srcdir=DIR' option. If we're building
|
||||
dnl with gcc, don't append the includedir if it happens to be /usr/include,
|
||||
dnl since that usually breaks gcc's shadow-includes.
|
||||
AC_DEFUN([CF_INCLUDE_DIRS],
|
||||
[
|
||||
CPPFLAGS="$CPPFLAGS -I. -I../include"
|
||||
if test "$srcdir" != "."; then
|
||||
CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
|
||||
fi
|
||||
if test "$GCC" != yes; then
|
||||
CPPFLAGS="$CPPFLAGS -I\${includedir}"
|
||||
elif test "$includedir" != "/usr/include"; then
|
||||
if test "$includedir" = '${prefix}/include' ; then
|
||||
if test $prefix != /usr ; then
|
||||
CPPFLAGS="$CPPFLAGS -I\${includedir}"
|
||||
fi
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS -I\${includedir}"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(CPPFLAGS)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_INCLUDE_PATH version: 5 updated: 2010/01/17 20:36:17
|
||||
dnl ---------------
|
||||
dnl Adds to the include-path
|
||||
dnl
|
||||
dnl Autoconf 1.11 should have provided a way to add include path options to
|
||||
dnl the cpp-tests.
|
||||
dnl
|
||||
AC_DEFUN([CF_INCLUDE_PATH],
|
||||
[
|
||||
$1=
|
||||
for cf_path in $1
|
||||
do
|
||||
cf_result="no"
|
||||
AC_MSG_CHECKING(for directory $cf_path)
|
||||
if test -d $cf_path
|
||||
then
|
||||
INCLUDES="$INCLUDES -I$cf_path"
|
||||
ac_cpp="${ac_cpp} -I$cf_path"
|
||||
CFLAGS="$CFLAGS -I$cf_path"
|
||||
cf_result="yes"
|
||||
case $cf_path in
|
||||
/usr/include|/usr/include/*)
|
||||
;;
|
||||
*)
|
||||
CF_DIRNAME(cf_temp,$cf_path)
|
||||
case $cf_temp in
|
||||
*/include)
|
||||
INCLUDES="$INCLUDES -I$cf_temp"
|
||||
ac_cpp="${ac_cpp} -I$cf_temp"
|
||||
CFLAGS="$CFLAGS -I$cf_temp"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT($cf_result)
|
||||
done
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
|
||||
dnl -----------------
|
||||
dnl Check if the given compiler is really the Intel compiler for Linux. It
|
||||
@ -2347,7 +2293,7 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50
|
||||
dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
|
||||
dnl ------------
|
||||
dnl Add checks for large file support.
|
||||
AC_DEFUN([CF_LARGEFILE],[
|
||||
@ -2381,7 +2327,7 @@ ifdef([AC_FUNC_FSEEKO],[
|
||||
[cf_cv_struct_dirent64=yes],
|
||||
[cf_cv_struct_dirent64=no])
|
||||
])
|
||||
test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
|
||||
test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
|
||||
fi
|
||||
])
|
||||
])
|
||||
@ -2587,7 +2533,7 @@ ifelse($1,,[
|
||||
fi
|
||||
])
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_MBSTATE_T version: 3 updated: 2007/03/25 15:55:36
|
||||
dnl CF_MBSTATE_T version: 4 updated: 2012/10/06 08:57:51
|
||||
dnl ------------
|
||||
dnl Check if mbstate_t is declared, and if so, which header file.
|
||||
dnl This (including wchar.h) is needed on Tru64 5.0 to declare mbstate_t,
|
||||
@ -2615,15 +2561,15 @@ AC_TRY_COMPILE([
|
||||
[cf_cv_mbstate_t=unknown])])])
|
||||
|
||||
if test "$cf_cv_mbstate_t" = yes ; then
|
||||
AC_DEFINE(NEED_WCHAR_H)
|
||||
AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
|
||||
fi
|
||||
|
||||
if test "$cf_cv_mbstate_t" != unknown ; then
|
||||
AC_DEFINE(HAVE_MBSTATE_T)
|
||||
AC_DEFINE(HAVE_MBSTATE_T,1,[Define to 1 if mbstate_t is declared])
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
|
||||
dnl CF_MIXEDCASE_FILENAMES version: 4 updated: 2012/10/02 20:55:03
|
||||
dnl ----------------------
|
||||
dnl Check if the file-system supports mixed-case filenames. If we're able to
|
||||
dnl create a lowercase name and see it as uppercase, it doesn't support that.
|
||||
@ -2650,7 +2596,7 @@ else
|
||||
rm -f conftest CONFTEST
|
||||
fi
|
||||
])
|
||||
test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
|
||||
test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
|
||||
@ -2694,7 +2640,7 @@ printf("old\n");
|
||||
,[$1=no])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_NCURSES_CONFIG version: 9 updated: 2011/11/26 15:42:05
|
||||
dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51
|
||||
dnl -----------------
|
||||
dnl Tie together the configure-script macros for ncurses.
|
||||
dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
|
||||
@ -2720,7 +2666,7 @@ CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
|
||||
CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
|
||||
|
||||
dnl like CF_NCURSES_CPPFLAGS
|
||||
AC_DEFINE(NCURSES)
|
||||
AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
|
||||
|
||||
dnl like CF_NCURSES_LIBS
|
||||
CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
|
||||
@ -2737,7 +2683,7 @@ CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
|
||||
fi
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_NCURSES_CPPFLAGS version: 20 updated: 2010/11/20 17:02:38
|
||||
dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
|
||||
dnl -------------------
|
||||
dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
|
||||
dnl the CPPFLAGS variable so we can include its header.
|
||||
@ -2783,12 +2729,12 @@ CF_NCURSES_HEADER
|
||||
CF_TERM_HEADER
|
||||
|
||||
# some applications need this, but should check for NCURSES_VERSION
|
||||
AC_DEFINE(NCURSES)
|
||||
AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
|
||||
|
||||
CF_NCURSES_VERSION
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
|
||||
dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51
|
||||
dnl -----------------
|
||||
dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
|
||||
dnl variations of ncurses' installs.
|
||||
@ -2839,16 +2785,16 @@ fi
|
||||
|
||||
case $cf_cv_ncurses_header in # (vi
|
||||
*ncurses.h)
|
||||
AC_DEFINE(HAVE_NCURSES_H)
|
||||
AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
|
||||
;;
|
||||
esac
|
||||
|
||||
case $cf_cv_ncurses_header in # (vi
|
||||
ncurses/curses.h|ncurses/ncurses.h)
|
||||
AC_DEFINE(HAVE_NCURSES_NCURSES_H)
|
||||
AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
|
||||
;;
|
||||
ncursesw/curses.h|ncursesw/ncurses.h)
|
||||
AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
|
||||
AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -2922,7 +2868,7 @@ CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
|
||||
AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49
|
||||
dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
|
||||
dnl ------------------
|
||||
dnl Check for the version of ncurses, to aid in reporting bugs, etc.
|
||||
dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
|
||||
@ -2981,17 +2927,17 @@ EOF
|
||||
])
|
||||
rm -f $cf_tempfile
|
||||
])
|
||||
test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
|
||||
test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
|
||||
dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03
|
||||
dnl ------------------
|
||||
dnl see CF_WITH_NO_LEAKS
|
||||
AC_DEFUN([CF_NO_LEAKS_OPTION],[
|
||||
AC_MSG_CHECKING(if you want to use $1 for testing)
|
||||
AC_ARG_WITH($1,
|
||||
[$2],
|
||||
[AC_DEFINE($3)ifelse([$4],,[
|
||||
[AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
|
||||
$4
|
||||
])
|
||||
: ${with_cflags:=-g}
|
||||
@ -3050,20 +2996,23 @@ AC_SUBST(MSG_DIR_MAKE)
|
||||
AC_SUBST(SUB_MAKEFILE)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42
|
||||
dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
|
||||
dnl ----------
|
||||
dnl Provide a value for the $PATH and similar separator
|
||||
dnl Provide a value for the $PATH and similar separator (or amend the value
|
||||
dnl as provided in autoconf 2.5x).
|
||||
AC_DEFUN([CF_PATHSEP],
|
||||
[
|
||||
AC_MSG_CHECKING(for PATH separator)
|
||||
case $cf_cv_system_name in
|
||||
os2*) PATH_SEPARATOR=';' ;;
|
||||
*) PATH_SEPARATOR=':' ;;
|
||||
*) ${PATH_SEPARATOR:=':'} ;;
|
||||
esac
|
||||
ifelse([$1],,,[$1=$PATH_SEPARATOR])
|
||||
AC_SUBST(PATH_SEPARATOR)
|
||||
AC_MSG_RESULT($PATH_SEPARATOR)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
|
||||
dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
|
||||
dnl --------------
|
||||
dnl Check the argument to see that it looks like a pathname. Rewrite it if it
|
||||
dnl begins with one of the prefix/exec_prefix variables, and then again if the
|
||||
@ -3083,7 +3032,7 @@ case ".[$]$1" in #(vi
|
||||
;;
|
||||
.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
|
||||
;;
|
||||
.\[$]{*prefix}*) #(vi
|
||||
.\[$]{*prefix}*|.\[$]{*dir}*) #(vi
|
||||
eval $1="[$]$1"
|
||||
case ".[$]$1" in #(vi
|
||||
.NONE/*)
|
||||
@ -3173,32 +3122,20 @@ fi
|
||||
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
|
||||
dnl --------------
|
||||
dnl Check if C (preprocessor) -U and -D options are processed in the order
|
||||
dnl given rather than by type of option. Some compilers insist on apply all
|
||||
dnl of the -U options after all of the -D options. Others allow mixing them,
|
||||
dnl and may predefine symbols that conflict with those we define.
|
||||
AC_DEFUN([CF_PROG_CC_U_D],
|
||||
[
|
||||
AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
|
||||
cf_save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
|
||||
AC_TRY_COMPILE([],[
|
||||
#ifndef U_D_OPTIONS
|
||||
make an undefined-error
|
||||
#endif
|
||||
#ifdef D_U_OPTIONS
|
||||
make a defined-error
|
||||
#endif
|
||||
],[
|
||||
cf_cv_cc_u_d_options=yes],[
|
||||
cf_cv_cc_u_d_options=no])
|
||||
CPPFLAGS="$cf_save_CPPFLAGS"
|
||||
])
|
||||
dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
|
||||
dnl ----------
|
||||
dnl standard check for CC, plus followup sanity checks
|
||||
dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
|
||||
AC_DEFUN([CF_PROG_CC],[
|
||||
ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
|
||||
CF_GCC_VERSION
|
||||
CF_ACVERSION_CHECK(2.52,
|
||||
[AC_PROG_CC_STDC],
|
||||
[CF_ANSI_CC_REQD])
|
||||
CF_CC_ENV_FLAGS
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
|
||||
dnl CF_PROG_EXT version: 11 updated: 2012/10/06 08:57:51
|
||||
dnl -----------
|
||||
dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
|
||||
AC_DEFUN([CF_PROG_EXT],
|
||||
@ -3220,7 +3157,7 @@ AC_OBJEXT
|
||||
|
||||
PROG_EXT="$EXEEXT"
|
||||
AC_SUBST(PROG_EXT)
|
||||
test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
|
||||
test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
|
||||
@ -3380,58 +3317,7 @@ CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
|
||||
CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
|
||||
dnl --------
|
||||
dnl Shorthand macro for substituting things that the user may override
|
||||
dnl with an environment variable.
|
||||
dnl
|
||||
dnl $1 = long/descriptive name
|
||||
dnl $2 = environment variable
|
||||
dnl $3 = default value
|
||||
AC_DEFUN([CF_SUBST],
|
||||
[AC_CACHE_VAL(cf_cv_subst_$2,[
|
||||
AC_MSG_CHECKING(for $1 (symbol $2))
|
||||
CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
|
||||
cf_cv_subst_$2=[$]$2
|
||||
AC_MSG_RESULT([$]$2)
|
||||
])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_SYSTYPE version: 3 updated: 2001/02/03 00:14:59
|
||||
dnl ----------
|
||||
dnl Derive the system-type (our main clue to the method of building shared
|
||||
dnl libraries).
|
||||
AC_DEFUN([CF_SYSTYPE],
|
||||
[
|
||||
AC_MSG_CHECKING(for system type)
|
||||
AC_CACHE_VAL(cf_cv_systype,[
|
||||
AC_ARG_WITH(system-type,
|
||||
[ --with-system-type=XXX test: override derived host system-type],
|
||||
[cf_cv_systype=$withval],
|
||||
[
|
||||
cf_cv_systype="`(uname -s || hostname || echo unknown) 2>/dev/null |sed -e s'/[[:\/.-]]/_/'g | sed 1q`"
|
||||
if test -z "$cf_cv_systype"; then cf_cv_systype=unknown;fi
|
||||
])])
|
||||
AC_MSG_RESULT($cf_cv_systype)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_SYS_NAME version: 3 updated: 2008/03/23 14:48:54
|
||||
dnl -----------
|
||||
dnl Derive the system name, as a check for reusing the autoconf cache
|
||||
AC_DEFUN([CF_SYS_NAME],
|
||||
[
|
||||
SYS_NAME=`(uname -s -r || uname -a || hostname) 2>/dev/null | sed 1q`
|
||||
test -z "$SYS_NAME" && SYS_NAME=unknown
|
||||
AC_DEFINE_UNQUOTED(SYS_NAME,"$SYS_NAME")
|
||||
|
||||
AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$SYS_NAME"])
|
||||
|
||||
if test ".$SYS_NAME" != ".$cf_cv_system_name" ; then
|
||||
AC_MSG_RESULT("Cached system name does not agree with actual")
|
||||
AC_MSG_ERROR("Please remove config.cache and try again.")
|
||||
fi])
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49
|
||||
dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51
|
||||
dnl --------------
|
||||
dnl Look for term.h, which is part of X/Open curses. It defines the interface
|
||||
dnl to terminfo database. Usually it is in the same include-path as curses.h,
|
||||
@ -3464,16 +3350,16 @@ done
|
||||
|
||||
case $cf_cv_term_header in # (vi
|
||||
*term.h)
|
||||
AC_DEFINE(HAVE_TERM_H)
|
||||
AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
|
||||
;;
|
||||
esac
|
||||
|
||||
case $cf_cv_term_header in # (vi
|
||||
ncurses/term.h) #(vi
|
||||
AC_DEFINE(HAVE_NCURSES_TERM_H)
|
||||
AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
|
||||
;;
|
||||
ncursesw/term.h)
|
||||
AC_DEFINE(HAVE_NCURSESW_TERM_H)
|
||||
AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
|
||||
;;
|
||||
esac
|
||||
])dnl
|
||||
@ -3517,7 +3403,7 @@ if test "$cf_cv_xopen_source" != no ; then
|
||||
fi
|
||||
])
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_UNION_WAIT version: 5 updated: 1997/11/23 14:49:44
|
||||
dnl CF_UNION_WAIT version: 6 updated: 2012/10/06 08:57:51
|
||||
dnl -------------
|
||||
dnl Check to see if the BSD-style union wait is declared. Some platforms may
|
||||
dnl use this, though it is deprecated in favor of the 'int' type in Posix.
|
||||
@ -3560,7 +3446,7 @@ AC_CACHE_VAL(cf_cv_type_unionwait,[
|
||||
],
|
||||
[cf_cv_type_unionwait=no])])])
|
||||
AC_MSG_RESULT($cf_cv_type_unionwait)
|
||||
test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT)
|
||||
test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT,1,[Define to 1 if type unionwait is declared])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
|
||||
@ -3572,7 +3458,7 @@ AC_DEFUN([CF_UPPER],
|
||||
$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28
|
||||
dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
|
||||
dnl -----------
|
||||
dnl Check for multibyte support, and if not found, utf8 compatibility library
|
||||
AC_DEFUN([CF_UTF8_LIB],
|
||||
@ -3591,7 +3477,7 @@ AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
|
||||
# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
|
||||
# ncurses/ncursesw:
|
||||
if test "$cf_cv_utf8_lib" = "add-on" ; then
|
||||
AC_DEFINE(HAVE_LIBUTF8_H)
|
||||
AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
|
||||
CF_ADD_INCDIR($cf_cv_header_path_utf8)
|
||||
CF_ADD_LIBDIR($cf_cv_library_path_utf8)
|
||||
CF_ADD_LIBS($cf_cv_library_file_utf8)
|
||||
@ -3606,7 +3492,7 @@ AC_DEFUN([CF_VERBOSE],
|
||||
CF_MSG_LOG([$1])
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_VERSION_INFO version: 4 updated: 2011/01/02 19:09:47
|
||||
dnl CF_VERSION_INFO version: 5 updated: 2012/10/06 08:57:51
|
||||
dnl ---------------
|
||||
dnl Define several useful symbols derived from the VERSION file. A separate
|
||||
dnl file is preferred to embedding the version numbers in various scripts.
|
||||
@ -3686,7 +3572,7 @@ dnl need the package name to ensure that the defined symbols are unique.
|
||||
ifelse($1,,,[
|
||||
cf_PACKAGE=$1
|
||||
PACKAGE=ifelse($2,,$1,$2)
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name])
|
||||
AC_SUBST(PACKAGE)
|
||||
CF_UPPER(cf_PACKAGE,$cf_PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}")
|
||||
@ -3946,7 +3832,7 @@ esac
|
||||
AC_SUBST(LIBTOOL_OPTS)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_WITH_NO_LEAKS version: 1 updated: 2006/12/14 18:00:21
|
||||
dnl CF_WITH_NO_LEAKS version: 2 updated: 2012/10/06 08:57:51
|
||||
dnl ----------------
|
||||
AC_DEFUN([CF_WITH_NO_LEAKS],[
|
||||
|
||||
@ -3958,11 +3844,11 @@ AC_REQUIRE([CF_WITH_VALGRIND])
|
||||
AC_MSG_CHECKING(if you want to perform memory-leak testing)
|
||||
AC_ARG_WITH(no-leaks,
|
||||
[ --with-no-leaks test: free permanent memory, analyze leaks],
|
||||
[AC_DEFINE(NO_LEAKS)
|
||||
[AC_DEFINE(NO_LEAKS,1,[Define to 1 to enable leak-checking])
|
||||
cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}"
|
||||
case ${cf_doalloc} in #(vi
|
||||
*yes*) ;;
|
||||
*) AC_DEFINE(DOALLOC,10000) ;;
|
||||
*) AC_DEFINE(DOALLOC,10000,[Define to size of malloc-array]) ;;
|
||||
esac
|
||||
with_no_leaks=yes],
|
||||
[with_no_leaks=])
|
||||
|
10
argv.c
10
argv.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: argv.c,v 1.1 2011/03/02 09:56:39 tom Exp $
|
||||
* $Id: argv.c,v 1.2 2012/11/30 20:28:23 tom Exp $
|
||||
*
|
||||
* argv - Reusable functions for argv-parsing.
|
||||
*
|
||||
* Copyright 2011 Thomas E. Dickey
|
||||
* Copyright 2011,2012 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
|
||||
@ -56,12 +56,6 @@ dlg_string_to_argv(char *blob)
|
||||
}
|
||||
} else if (blob[n] == '\\') {
|
||||
if (quoted && !isspace(UCH(blob[n + 1]))) {
|
||||
if (!inparm) {
|
||||
if (pass)
|
||||
result[count] = param;
|
||||
++count;
|
||||
inparm = TRUE;
|
||||
}
|
||||
if (pass) {
|
||||
*param++ = blob[n];
|
||||
*param++ = blob[n + 1];
|
||||
|
32
arrows.c
32
arrows.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: arrows.c,v 1.41 2011/10/20 23:37:17 tom Exp $
|
||||
* $Id: arrows.c,v 1.50 2013/05/24 00:05:21 tom Exp $
|
||||
*
|
||||
* arrows.c -- draw arrows to indicate end-of-range for lists
|
||||
*
|
||||
* Copyright 2000-2010,2011 Thomas E. Dickey
|
||||
* Copyright 2000-2012,2013 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
|
||||
@ -136,7 +136,7 @@ dlg_draw_arrows2(WINDOW *win,
|
||||
|
||||
(void) wmove(win, bottom, x);
|
||||
if (bottom_arrow) {
|
||||
(void) wattrset(win, merge_colors(darrow_attr, attr));
|
||||
(void) wattrset(win, merge_colors(darrow_attr, borderattr));
|
||||
(void) add_acs(win, ACS_DARROW);
|
||||
(void) waddstr(win, "(+)");
|
||||
} else {
|
||||
@ -196,34 +196,48 @@ dlg_draw_scrollbar(WINDOW *win,
|
||||
whline(win, dlg_boxchar(ACS_HLINE), 4 - len);
|
||||
}
|
||||
}
|
||||
#define BARSIZE(num) (int) (((all_high * (num)) + all_high - 1) / total_data)
|
||||
#define BARSIZE(num) (int) (0.5 + (double) ((all_high * (int) (num)) / (double) total_data))
|
||||
#define ORDSIZE(num) (int) ((double) ((all_high * (int) (num)) / (double) all_diff))
|
||||
|
||||
if (dialog_state.use_scrollbar) {
|
||||
int all_high = (bottom - top - 1);
|
||||
|
||||
this_data = MAX(0, this_data);
|
||||
|
||||
if (total_data > 0 && all_high > 0) {
|
||||
int all_diff = (int) (total_data + 1);
|
||||
int bar_diff = (int) (next_data + 1 - this_data);
|
||||
int bar_high;
|
||||
int bar_y;
|
||||
|
||||
bar_high = BARSIZE(next_data - this_data);
|
||||
bar_high = ORDSIZE(bar_diff);
|
||||
if (bar_high <= 0)
|
||||
bar_high = 1;
|
||||
|
||||
if (bar_high < all_high) {
|
||||
int bar_last = BARSIZE(next_data);
|
||||
|
||||
wmove(win, top + 1, right);
|
||||
|
||||
(void) wattrset(win, save);
|
||||
wvline(win, ACS_VLINE | A_REVERSE, all_high);
|
||||
|
||||
bar_y = BARSIZE(this_data);
|
||||
if (bar_y > all_high - bar_high)
|
||||
bar_y = all_high - bar_high;
|
||||
bar_y = ORDSIZE(this_data);
|
||||
if (bar_y >= bar_last && bar_y > 0)
|
||||
bar_y = bar_last - 1;
|
||||
if (bar_last - bar_y > bar_high && bar_high > 1)
|
||||
++bar_y;
|
||||
bar_last = MIN(bar_last, all_high);
|
||||
|
||||
wmove(win, top + 1 + bar_y, right);
|
||||
|
||||
(void) wattrset(win, position_indicator_attr);
|
||||
wattron(win, A_REVERSE);
|
||||
wvline(win, ACS_BLOCK, bar_high);
|
||||
#if defined(WACS_BLOCK) && defined(NCURSES_VERSION) && defined(USE_WIDE_CURSES)
|
||||
wvline_set(win, WACS_BLOCK, bar_last - bar_y);
|
||||
#else
|
||||
wvline(win, ACS_BLOCK, bar_last - bar_y);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1111
buildlist.c
Normal file
1111
buildlist.c
Normal file
File diff suppressed because it is too large
Load Diff
213
buttons.c
213
buttons.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: buttons.c,v 1.90 2012/07/01 20:42:05 tom Exp $
|
||||
* $Id: buttons.c,v 1.94 2012/12/30 20:51:01 tom Exp $
|
||||
*
|
||||
* buttons.c -- draw buttons, e.g., OK/Cancel
|
||||
*
|
||||
@ -28,7 +28,7 @@
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#define MIN_BUTTON (dialog_state.visit_items ? -1 : 0)
|
||||
#define MIN_BUTTON (-dialog_state.visit_cols)
|
||||
|
||||
static void
|
||||
center_label(char *buffer, int longest, const char *label)
|
||||
@ -86,11 +86,85 @@ string_to_char(const char **stringp)
|
||||
return result;
|
||||
}
|
||||
|
||||
static size_t
|
||||
count_labels(const char **labels)
|
||||
{
|
||||
size_t result = 0;
|
||||
if (labels != 0) {
|
||||
while (*labels++ != 0) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the latest key should be added to the hotkey list.
|
||||
*/
|
||||
static int
|
||||
was_hotkey(int this_key, int *used_keys, size_t next)
|
||||
{
|
||||
int result = FALSE;
|
||||
|
||||
if (next != 0) {
|
||||
size_t n;
|
||||
for (n = 0; n < next; ++n) {
|
||||
if (used_keys[n] == this_key) {
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine the hot-keys for a set of button-labels. Normally these are
|
||||
* the first uppercase character in each label. However, if more than one
|
||||
* button has the same first-uppercase, then we will (attempt to) look for
|
||||
* an alternate.
|
||||
*
|
||||
* This allocates data which must be freed by the caller.
|
||||
*/
|
||||
static int *
|
||||
get_hotkeys(const char **labels)
|
||||
{
|
||||
int *result = 0;
|
||||
size_t count = count_labels(labels);
|
||||
size_t n;
|
||||
|
||||
if ((result = dlg_calloc(int, count + 1)) != 0) {
|
||||
for (n = 0; n < count; ++n) {
|
||||
const char *label = labels[n];
|
||||
const int *indx = dlg_index_wchars(label);
|
||||
int limit = dlg_count_wchars(label);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < limit; ++i) {
|
||||
int first = indx[i];
|
||||
int check = UCH(label[first]);
|
||||
#ifdef USE_WIDE_CURSES
|
||||
int last = indx[i + 1];
|
||||
if ((last - first) != 1) {
|
||||
const char *temp = (label + first);
|
||||
check = string_to_char(&temp);
|
||||
}
|
||||
#endif
|
||||
if (dlg_isupper(check) && !was_hotkey(check, result, n)) {
|
||||
result[n] = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a button
|
||||
*/
|
||||
static void
|
||||
print_button(WINDOW *win, char *label, int y, int x, int selected)
|
||||
print_button(WINDOW *win, char *label, int hotkey, int y, int x, int selected)
|
||||
{
|
||||
int i;
|
||||
int state = 0;
|
||||
@ -110,23 +184,20 @@ print_button(WINDOW *win, char *label, int y, int x, int selected)
|
||||
(void) waddstr(win, "<");
|
||||
(void) wattrset(win, label_attr);
|
||||
for (i = 0; i < limit; ++i) {
|
||||
int check;
|
||||
int first = indx[i];
|
||||
int last = indx[i + 1];
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
check = UCH(label[first]);
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if ((last - first) != 1) {
|
||||
const char *temp = (label + first);
|
||||
int cmp = string_to_char(&temp);
|
||||
if (dlg_isupper(cmp)) {
|
||||
(void) wattrset(win, key_attr);
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
check = string_to_char(&temp);
|
||||
}
|
||||
#endif
|
||||
if (dlg_isupper(UCH(label[first]))) {
|
||||
if (check == hotkey) {
|
||||
(void) wattrset(win, key_attr);
|
||||
state = 1;
|
||||
}
|
||||
@ -203,22 +274,27 @@ dlg_button_x_step(const char **labels, int limit, int *gap, int *margin, int *st
|
||||
int length;
|
||||
int unused;
|
||||
int used;
|
||||
int result;
|
||||
|
||||
if (count == 0)
|
||||
return 0;
|
||||
dlg_button_sizes(labels, FALSE, &longest, &length);
|
||||
used = (length + (count * 2));
|
||||
unused = limit - used;
|
||||
*margin = 0;
|
||||
if (count != 0) {
|
||||
dlg_button_sizes(labels, FALSE, &longest, &length);
|
||||
used = (length + (count * 2));
|
||||
unused = limit - used;
|
||||
|
||||
if ((*gap = unused / (count + 3)) <= 0) {
|
||||
if ((*gap = unused / (count + 1)) <= 0)
|
||||
*gap = 1;
|
||||
*margin = *gap;
|
||||
if ((*gap = unused / (count + 3)) <= 0) {
|
||||
if ((*gap = unused / (count + 1)) <= 0)
|
||||
*gap = 1;
|
||||
*margin = *gap;
|
||||
} else {
|
||||
*margin = *gap * 2;
|
||||
}
|
||||
*step = *gap + (used + count - 1) / count;
|
||||
result = (*gap > 0) && (unused >= 0);
|
||||
} else {
|
||||
*margin = *gap * 2;
|
||||
result = 0;
|
||||
}
|
||||
*step = *gap + (used + count - 1) / count;
|
||||
return (*gap > 0) && (unused >= 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -282,35 +358,41 @@ dlg_draw_buttons(WINDOW *win,
|
||||
* Allocate a buffer big enough for any label.
|
||||
*/
|
||||
need = (size_t) longest;
|
||||
for (n = 0; labels[n] != 0; ++n) {
|
||||
need += strlen(labels[n]) + 1;
|
||||
}
|
||||
buffer = dlg_malloc(char, need);
|
||||
assert_ptr(buffer, "dlg_draw_buttons");
|
||||
if (need != 0) {
|
||||
int *hotkeys = get_hotkeys(labels);
|
||||
assert_ptr(hotkeys, "dlg_draw_buttons");
|
||||
|
||||
/*
|
||||
* Draw the labels.
|
||||
*/
|
||||
for (n = 0; labels[n] != 0; n++) {
|
||||
center_label(buffer, longest, labels[n]);
|
||||
mouse_mkbutton(y, x, dlg_count_columns(buffer), n);
|
||||
print_button(win, buffer, y, x,
|
||||
(selected == n) || (n == 0 && selected < 0));
|
||||
if (selected == n)
|
||||
getyx(win, final_y, final_x);
|
||||
|
||||
if (vertical) {
|
||||
if ((y += step) > limit)
|
||||
break;
|
||||
} else {
|
||||
if ((x += step) > limit)
|
||||
break;
|
||||
for (n = 0; labels[n] != 0; ++n) {
|
||||
need += strlen(labels[n]) + 1;
|
||||
}
|
||||
buffer = dlg_malloc(char, need);
|
||||
assert_ptr(buffer, "dlg_draw_buttons");
|
||||
|
||||
/*
|
||||
* Draw the labels.
|
||||
*/
|
||||
for (n = 0; labels[n] != 0; n++) {
|
||||
center_label(buffer, longest, labels[n]);
|
||||
mouse_mkbutton(y, x, dlg_count_columns(buffer), n);
|
||||
print_button(win, buffer, hotkeys[n], y, x,
|
||||
(selected == n) || (n == 0 && selected < 0));
|
||||
if (selected == n)
|
||||
getyx(win, final_y, final_x);
|
||||
|
||||
if (vertical) {
|
||||
if ((y += step) > limit)
|
||||
break;
|
||||
} else {
|
||||
if ((x += step) > limit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
(void) wmove(win, final_y, final_x);
|
||||
wrefresh(win);
|
||||
(void) wattrset(win, save);
|
||||
free(buffer);
|
||||
free(hotkeys);
|
||||
}
|
||||
(void) wmove(win, final_y, final_x);
|
||||
wrefresh(win);
|
||||
free(buffer);
|
||||
(void) wattrset(win, save);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -364,19 +446,27 @@ dlg_button_to_char(const char *label)
|
||||
int
|
||||
dlg_char_to_button(int ch, const char **labels)
|
||||
{
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
|
||||
if (labels != 0) {
|
||||
int *hotkeys = get_hotkeys(labels);
|
||||
int j;
|
||||
|
||||
ch = (int) dlg_toupper(dlg_last_getc());
|
||||
for (j = 0; labels[j] != 0; ++j) {
|
||||
int cmp = dlg_button_to_char(labels[j]);
|
||||
if (ch == cmp) {
|
||||
dlg_flush_getc();
|
||||
return j;
|
||||
|
||||
if (hotkeys != 0) {
|
||||
for (j = 0; labels[j] != 0; ++j) {
|
||||
if (ch == hotkeys[j]) {
|
||||
dlg_flush_getc();
|
||||
result = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(hotkeys);
|
||||
}
|
||||
}
|
||||
return DLG_EXIT_UNKNOWN;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static const char *
|
||||
@ -669,10 +759,14 @@ dlg_yes_buttoncode(int button)
|
||||
int
|
||||
dlg_next_button(const char **labels, int button)
|
||||
{
|
||||
if (labels[button + 1] != 0)
|
||||
if (button < -1)
|
||||
button = -1;
|
||||
|
||||
if (labels[button + 1] != 0) {
|
||||
++button;
|
||||
else
|
||||
} else {
|
||||
button = MIN_BUTTON;
|
||||
}
|
||||
return button;
|
||||
}
|
||||
|
||||
@ -682,9 +776,12 @@ dlg_next_button(const char **labels, int button)
|
||||
int
|
||||
dlg_prev_button(const char **labels, int button)
|
||||
{
|
||||
if (button > MIN_BUTTON)
|
||||
if (button > MIN_BUTTON) {
|
||||
--button;
|
||||
else {
|
||||
} else {
|
||||
if (button < -1)
|
||||
button = -1;
|
||||
|
||||
while (labels[button + 1] != 0)
|
||||
++button;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: calendar.c,v 1.66 2012/07/01 18:13:07 Zoltan.Kelemen Exp $
|
||||
* $Id: calendar.c,v 1.67 2013/03/17 15:03:41 tom Exp $
|
||||
*
|
||||
* calendar.c -- implements the calendar box
|
||||
*
|
||||
* Copyright 2001-2011,2012 Thomas E. Dickey
|
||||
* Copyright 2001-2012,2013 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
|
||||
@ -681,6 +681,7 @@ dialog_calendar(const char *title,
|
||||
|
||||
dlg_add_result(buffer);
|
||||
dlg_add_separator();
|
||||
dlg_add_last_key(-1);
|
||||
|
||||
return CleanupResult(result, dialog, prompt, &save_vars);
|
||||
}
|
||||
|
389
checklist.c
389
checklist.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: checklist.c,v 1.135 2012/07/01 16:30:04 Zoltan.Kelemen Exp $
|
||||
* $Id: checklist.c,v 1.151 2013/03/23 10:51:48 tom Exp $
|
||||
*
|
||||
* checklist.c -- implements the checklist box
|
||||
*
|
||||
* Copyright 2000-2011,2012 Thomas E. Dickey
|
||||
* Copyright 2000-2012,2013 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
|
||||
@ -29,45 +29,32 @@
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
static int list_width, check_x, item_x, checkflag;
|
||||
|
||||
#define MIN_HIGH (1 + (5 * MARGIN))
|
||||
|
||||
#define LLEN(n) ((n) * CHECKBOX_TAGS)
|
||||
#define ItemData(i) &items[LLEN(i)]
|
||||
#define ItemName(i) items[LLEN(i)]
|
||||
#define ItemText(i) items[LLEN(i) + 1]
|
||||
#define ItemStatus(i) items[LLEN(i) + 2]
|
||||
#define ItemHelp(i) items[LLEN(i) + 3]
|
||||
|
||||
static void
|
||||
print_arrows(WINDOW *win,
|
||||
int box_x,
|
||||
int box_y,
|
||||
int scrollamt,
|
||||
int choice,
|
||||
int item_no,
|
||||
int list_height)
|
||||
{
|
||||
dlg_draw_scrollbar(win,
|
||||
(long) (scrollamt),
|
||||
(long) (scrollamt),
|
||||
(long) (scrollamt + choice),
|
||||
(long) (item_no),
|
||||
box_x + check_x,
|
||||
box_x + list_width,
|
||||
box_y,
|
||||
box_y + list_height + 1,
|
||||
menubox_border2_attr,
|
||||
menubox_border_attr);
|
||||
}
|
||||
typedef struct {
|
||||
/* the outer-window */
|
||||
WINDOW *dialog;
|
||||
int box_y;
|
||||
int box_x;
|
||||
int check_x;
|
||||
int item_x;
|
||||
int checkflag;
|
||||
int use_height;
|
||||
int use_width;
|
||||
/* the inner-window */
|
||||
WINDOW *list;
|
||||
DIALOG_LISTITEM *items;
|
||||
int item_no;
|
||||
const char *states;
|
||||
} ALL_DATA;
|
||||
|
||||
/*
|
||||
* Print list item. The 'selected' parameter is true if 'choice' is the
|
||||
* current item. That one is colored differently from the other items.
|
||||
*/
|
||||
static void
|
||||
print_item(WINDOW *win,
|
||||
print_item(ALL_DATA * data,
|
||||
WINDOW *win,
|
||||
DIALOG_LISTITEM * item,
|
||||
const char *states,
|
||||
int choice,
|
||||
@ -75,53 +62,34 @@ print_item(WINDOW *win,
|
||||
{
|
||||
chtype save = dlg_get_attrs(win);
|
||||
int i;
|
||||
chtype attr = A_NORMAL;
|
||||
const int *cols;
|
||||
const int *indx;
|
||||
int limit;
|
||||
bool both = (!dialog_vars.no_tags && !dialog_vars.no_items);
|
||||
bool first = TRUE;
|
||||
int climit = (getmaxx(win) - data->check_x + 1);
|
||||
const char *show = (dialog_vars.no_items
|
||||
? item->name
|
||||
: item->text);
|
||||
|
||||
/* Clear 'residue' of last item */
|
||||
(void) wattrset(win, menubox_attr);
|
||||
(void) wmove(win, choice, 0);
|
||||
for (i = 0; i < list_width; i++)
|
||||
for (i = 0; i < data->use_width; i++)
|
||||
(void) waddch(win, ' ');
|
||||
|
||||
(void) wmove(win, choice, check_x);
|
||||
(void) wmove(win, choice, data->check_x);
|
||||
(void) wattrset(win, selected ? check_selected_attr : check_attr);
|
||||
(void) wprintw(win,
|
||||
(checkflag == FLAG_CHECK) ? "[%c]" : "(%c)",
|
||||
(data->checkflag == FLAG_CHECK) ? "[%c]" : "(%c)",
|
||||
states[item->state]);
|
||||
(void) wattrset(win, menubox_attr);
|
||||
(void) waddch(win, ' ');
|
||||
|
||||
if (strlen(item->name) != 0) {
|
||||
|
||||
indx = dlg_index_wchars(item->name);
|
||||
|
||||
(void) wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
|
||||
(void) waddnstr(win, item->name, indx[1]);
|
||||
|
||||
if ((int) strlen(item->name) > indx[1]) {
|
||||
limit = dlg_limit_columns(item->name, (item_x - check_x - 6), 1);
|
||||
if (limit > 1) {
|
||||
(void) wattrset(win, selected ? tag_selected_attr : tag_attr);
|
||||
(void) waddnstr(win,
|
||||
item->name + indx[1],
|
||||
indx[limit] - indx[1]);
|
||||
}
|
||||
}
|
||||
if (both) {
|
||||
dlg_print_listitem(win, item->name, climit, first, selected);
|
||||
first = FALSE;
|
||||
}
|
||||
|
||||
if (strlen(item->text) != 0) {
|
||||
cols = dlg_index_columns(item->text);
|
||||
limit = dlg_limit_columns(item->text, (getmaxx(win) - item_x + 1), 0);
|
||||
|
||||
if (limit > 0) {
|
||||
(void) wmove(win, choice, item_x);
|
||||
(void) wattrset(win, selected ? item_selected_attr : item_attr);
|
||||
dlg_print_text(win, item->text, cols[limit], &attr);
|
||||
}
|
||||
}
|
||||
(void) wmove(win, choice, data->item_x);
|
||||
dlg_print_listitem(win, show, climit, first, selected);
|
||||
|
||||
if (selected) {
|
||||
dlg_item_help(item->help);
|
||||
@ -129,6 +97,51 @@ print_item(WINDOW *win,
|
||||
(void) wattrset(win, save);
|
||||
}
|
||||
|
||||
static void
|
||||
print_list(ALL_DATA * data, int choice, int scrollamt, int max_choice)
|
||||
{
|
||||
int i;
|
||||
int cur_y, cur_x;
|
||||
|
||||
getyx(data->dialog, cur_y, cur_x);
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(data,
|
||||
data->list,
|
||||
&data->items[i + scrollamt],
|
||||
data->states,
|
||||
i, i == choice);
|
||||
}
|
||||
(void) wnoutrefresh(data->list);
|
||||
|
||||
dlg_draw_scrollbar(data->dialog,
|
||||
(long) (scrollamt),
|
||||
(long) (scrollamt),
|
||||
(long) (scrollamt + max_choice),
|
||||
(long) (data->item_no),
|
||||
data->box_x + data->check_x,
|
||||
data->box_x + data->use_width,
|
||||
data->box_y,
|
||||
data->box_y + data->use_height + 1,
|
||||
menubox_border2_attr,
|
||||
menubox_border_attr);
|
||||
|
||||
(void) wmove(data->dialog, cur_y, cur_x);
|
||||
}
|
||||
|
||||
static bool
|
||||
check_hotkey(DIALOG_LISTITEM * items, int choice)
|
||||
{
|
||||
bool result = FALSE;
|
||||
|
||||
if (dlg_match_char(dlg_last_getc(),
|
||||
(dialog_vars.no_tags
|
||||
? items[choice].text
|
||||
: items[choice].name))) {
|
||||
result = TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an alternate interface to 'checklist' which allows the application
|
||||
* to read the list item states back directly without putting them in the
|
||||
@ -176,22 +189,26 @@ dlg_checklist(const char *title,
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
int i, j, key2, found, x, y, cur_x, cur_y, box_x, box_y;
|
||||
ALL_DATA all;
|
||||
int i, j, key2, found, x, y, cur_x, cur_y;
|
||||
int key = 0, fkey;
|
||||
int button = dialog_state.visit_items ? -1 : dlg_default_button();
|
||||
int choice = dlg_default_listitem(items);
|
||||
int scrollamt = 0;
|
||||
int max_choice;
|
||||
int was_mouse;
|
||||
int use_height;
|
||||
int use_width, name_width, text_width;
|
||||
int use_width, list_width, name_width, text_width;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int num_states;
|
||||
WINDOW *dialog, *list;
|
||||
WINDOW *dialog;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
const char *widget_name;
|
||||
|
||||
memset(&all, 0, sizeof(all));
|
||||
all.items = items;
|
||||
all.item_no = item_no;
|
||||
|
||||
dlg_does_output();
|
||||
dlg_tab_correct_str(prompt);
|
||||
|
||||
@ -220,15 +237,17 @@ dlg_checklist(const char *title,
|
||||
retry:
|
||||
#endif
|
||||
|
||||
use_height = list_height;
|
||||
all.use_height = list_height;
|
||||
use_width = dlg_calc_list_width(item_no, items) + 10;
|
||||
use_width = MAX(26, use_width);
|
||||
if (use_height == 0) {
|
||||
if (all.use_height == 0) {
|
||||
/* calculate height without items (4) */
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, use_width);
|
||||
dlg_calc_listh(&height, &use_height, item_no);
|
||||
dlg_calc_listh(&height, &all.use_height, item_no);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, use_width);
|
||||
dlg_auto_size(title, prompt,
|
||||
&height, &width,
|
||||
MIN_HIGH + all.use_height, use_width);
|
||||
}
|
||||
dlg_button_layout(buttons, &width);
|
||||
dlg_print_size(height, width);
|
||||
@ -238,13 +257,15 @@ dlg_checklist(const char *title,
|
||||
if (states == 0 || strlen(states) < 2)
|
||||
states = " *";
|
||||
num_states = (int) strlen(states);
|
||||
all.states = states;
|
||||
|
||||
checkflag = flag;
|
||||
all.checkflag = flag;
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
all.dialog = dialog;
|
||||
dlg_register_window(dialog, widget_name, binding);
|
||||
dlg_register_buttons(dialog, widget_name, buttons);
|
||||
|
||||
@ -257,30 +278,31 @@ dlg_checklist(const char *title,
|
||||
(void) wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
list_width = width - 6;
|
||||
all.use_width = width - 6;
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - list_width) / 2 - 1;
|
||||
all.box_y = cur_y + 1;
|
||||
all.box_x = (width - all.use_width) / 2 - 1;
|
||||
|
||||
/*
|
||||
* After displaying the prompt, we know how much space we really have.
|
||||
* Limit the list to avoid overwriting the ok-button.
|
||||
*/
|
||||
if (use_height + MIN_HIGH > height - cur_y)
|
||||
use_height = height - MIN_HIGH - cur_y;
|
||||
if (use_height <= 0)
|
||||
use_height = 1;
|
||||
if (all.use_height + MIN_HIGH > height - cur_y)
|
||||
all.use_height = height - MIN_HIGH - cur_y;
|
||||
if (all.use_height <= 0)
|
||||
all.use_height = 1;
|
||||
|
||||
max_choice = MIN(use_height, item_no);
|
||||
max_choice = MIN(all.use_height, item_no);
|
||||
max_choice = MAX(max_choice, 1);
|
||||
|
||||
/* create new window for the list */
|
||||
list = dlg_sub_window(dialog, use_height, list_width,
|
||||
y + box_y + 1, x + box_x + 1);
|
||||
all.list = dlg_sub_window(dialog, all.use_height, all.use_width,
|
||||
y + all.box_y + 1, x + all.box_x + 1);
|
||||
|
||||
/* draw a box around the list items */
|
||||
dlg_draw_box(dialog, box_y, box_x,
|
||||
use_height + 2 * MARGIN,
|
||||
list_width + 2 * MARGIN,
|
||||
dlg_draw_box(dialog, all.box_y, all.box_x,
|
||||
all.use_height + 2 * MARGIN,
|
||||
all.use_width + 2 * MARGIN,
|
||||
menubox_border_attr, menubox_border2_attr);
|
||||
|
||||
text_width = 0;
|
||||
@ -295,48 +317,54 @@ dlg_checklist(const char *title,
|
||||
* one or both of them. If the name is no wider than 1/4 of the list,
|
||||
* leave it intact.
|
||||
*/
|
||||
use_width = (list_width - 6);
|
||||
if (text_width + name_width > use_width) {
|
||||
int need = (int) (0.25 * use_width);
|
||||
if (name_width > need) {
|
||||
int want = (int) (use_width * ((double) name_width) /
|
||||
(text_width + name_width));
|
||||
name_width = (want > need) ? want : need;
|
||||
use_width = (all.use_width - 6);
|
||||
if (dialog_vars.no_tags) {
|
||||
list_width = MIN(all.use_width, text_width);
|
||||
} else if (dialog_vars.no_items) {
|
||||
list_width = MIN(all.use_width, name_width);
|
||||
} else {
|
||||
if (text_width >= 0
|
||||
&& name_width >= 0
|
||||
&& use_width > 0
|
||||
&& text_width + name_width > use_width) {
|
||||
int need = (int) (0.25 * use_width);
|
||||
if (name_width > need) {
|
||||
int want = (int) (use_width * ((double) name_width) /
|
||||
(text_width + name_width));
|
||||
name_width = (want > need) ? want : need;
|
||||
}
|
||||
text_width = use_width - name_width;
|
||||
}
|
||||
text_width = use_width - name_width;
|
||||
list_width = (text_width + name_width);
|
||||
}
|
||||
|
||||
check_x = (use_width - (text_width + name_width)) / 2;
|
||||
item_x = name_width + check_x + 6;
|
||||
all.check_x = (use_width - list_width) / 2;
|
||||
all.item_x = ((dialog_vars.no_tags
|
||||
? 0
|
||||
: (dialog_vars.no_items
|
||||
? 0
|
||||
: (2 + name_width)))
|
||||
+ all.check_x + 4);
|
||||
|
||||
/* ensure we are scrolled to show the current choice */
|
||||
if (choice >= (max_choice + scrollamt)) {
|
||||
scrollamt = choice - max_choice + 1;
|
||||
scrollamt = MIN(scrollamt, max_choice + item_no - 1);
|
||||
if (choice >= (max_choice + scrollamt - 1)) {
|
||||
scrollamt = MAX(0, choice - max_choice + 1);
|
||||
choice = max_choice - 1;
|
||||
}
|
||||
/* Print the list */
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(list,
|
||||
&items[i + scrollamt],
|
||||
states,
|
||||
i, i == choice);
|
||||
}
|
||||
(void) wnoutrefresh(list);
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(box_y + 1, box_x, use_height, list_width + 2,
|
||||
dlg_mouse_mkbigregion(all.box_y + 1, all.box_x,
|
||||
all.use_height, all.use_width + 2,
|
||||
KEY_MAX, 1, 1, 1 /* by lines */ );
|
||||
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
|
||||
dlg_trace_win(dialog);
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
if (button < 0) /* --visit-items */
|
||||
wmove(dialog, box_y + choice + 1, box_x + check_x + 2);
|
||||
wmove(dialog, all.box_y + choice + 1, all.box_x + all.check_x + 2);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
@ -350,19 +378,8 @@ dlg_checklist(const char *title,
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
i = (key - KEY_MAX);
|
||||
if (i < max_choice) {
|
||||
/* De-highlight current item */
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, FALSE);
|
||||
/* Highlight new item */
|
||||
choice = (key - KEY_MAX);
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, TRUE);
|
||||
(void) wnoutrefresh(list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
|
||||
key = ' '; /* force the selected item to toggle */
|
||||
} else {
|
||||
@ -386,13 +403,15 @@ dlg_checklist(const char *title,
|
||||
if (next >= num_states)
|
||||
next = 0;
|
||||
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (flag == FLAG_CHECK) { /* checklist? */
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
items[current].state = next;
|
||||
print_item(list,
|
||||
print_item(&all, all.list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, TRUE);
|
||||
(void) wnoutrefresh(all.list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
} else { /* radiolist */
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (i != current) {
|
||||
@ -400,23 +419,19 @@ dlg_checklist(const char *title,
|
||||
}
|
||||
}
|
||||
if (items[current].state) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
items[current].state = next ? next : 1;
|
||||
print_item(list,
|
||||
print_item(&all, all.list,
|
||||
&items[current],
|
||||
states,
|
||||
choice, TRUE);
|
||||
(void) wnoutrefresh(all.list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
} else {
|
||||
items[current].state = 1;
|
||||
for (i = 0; i < max_choice; i++)
|
||||
print_item(list,
|
||||
&items[scrollamt + i],
|
||||
states,
|
||||
i, i == choice);
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
}
|
||||
}
|
||||
(void) wnoutrefresh(list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
||||
@ -429,7 +444,7 @@ dlg_checklist(const char *title,
|
||||
if (!fkey) {
|
||||
if (button < 0 || !dialog_state.visit_items) {
|
||||
for (j = scrollamt + choice + 1; j < item_no; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), items[j].name)) {
|
||||
if (check_hotkey(items, j)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
@ -437,7 +452,7 @@ dlg_checklist(const char *title,
|
||||
}
|
||||
if (!found) {
|
||||
for (j = 0; j <= scrollamt + choice; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), items[j].name)) {
|
||||
if (check_hotkey(items, j)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
@ -507,82 +522,17 @@ dlg_checklist(const char *title,
|
||||
if (i != choice) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (i < 0 || i >= max_choice) {
|
||||
#if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR < 5
|
||||
/*
|
||||
* Using wscrl to assist ncurses scrolling is not needed
|
||||
* in version 5.x
|
||||
*/
|
||||
if (i == -1) {
|
||||
if (use_height > 1) {
|
||||
/* De-highlight current first item */
|
||||
print_item(list,
|
||||
&items[scrollamt],
|
||||
states,
|
||||
0, FALSE);
|
||||
scrollok(list, TRUE);
|
||||
wscrl(list, -1);
|
||||
scrollok(list, FALSE);
|
||||
}
|
||||
scrollamt--;
|
||||
print_item(list,
|
||||
&items[scrollamt],
|
||||
states,
|
||||
0, TRUE);
|
||||
} else if (i == max_choice) {
|
||||
if (use_height > 1) {
|
||||
/* De-highlight current last item before scrolling up */
|
||||
print_item(list,
|
||||
&items[scrollamt + max_choice - 1],
|
||||
states,
|
||||
max_choice - 1, FALSE);
|
||||
scrollok(list, TRUE);
|
||||
wscrl(list, 1);
|
||||
scrollok(list, FALSE);
|
||||
}
|
||||
scrollamt++;
|
||||
print_item(list,
|
||||
&items[scrollamt + max_choice - 1],
|
||||
states,
|
||||
max_choice - 1, TRUE);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(list,
|
||||
&items[scrollamt + i],
|
||||
states,
|
||||
i, i == choice);
|
||||
}
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
(void) wnoutrefresh(list);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
} else {
|
||||
/* De-highlight current item */
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, FALSE);
|
||||
/* Highlight new item */
|
||||
choice = i;
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, TRUE);
|
||||
(void) wnoutrefresh(list);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
}
|
||||
}
|
||||
continue; /* wait for another key press */
|
||||
@ -651,7 +601,7 @@ dialog_checklist(const char *title,
|
||||
int flag)
|
||||
{
|
||||
int result;
|
||||
int i;
|
||||
int i, j;
|
||||
DIALOG_LISTITEM *listitems;
|
||||
bool separate_output = ((flag == FLAG_CHECK)
|
||||
&& (dialog_vars.separate_output));
|
||||
@ -661,13 +611,15 @@ dialog_checklist(const char *title,
|
||||
listitems = dlg_calloc(DIALOG_LISTITEM, (size_t) item_no + 1);
|
||||
assert_ptr(listitems, "dialog_checklist");
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
listitems[i].name = ItemName(i);
|
||||
listitems[i].text = ItemText(i);
|
||||
for (i = j = 0; i < item_no; ++i) {
|
||||
listitems[i].name = items[j++];
|
||||
listitems[i].text = (dialog_vars.no_items
|
||||
? dlg_strempty()
|
||||
: items[j++]);
|
||||
listitems[i].state = !dlg_strcmp(items[j++], "on");
|
||||
listitems[i].help = ((dialog_vars.item_help)
|
||||
? ItemHelp(i)
|
||||
? items[j++]
|
||||
: dlg_strempty());
|
||||
listitems[i].state = !dlg_strcmp(ItemStatus(i), "on");
|
||||
}
|
||||
dlg_align_columns(&listitems[0].text, (int) sizeof(DIALOG_LISTITEM), item_no);
|
||||
|
||||
@ -733,6 +685,7 @@ dialog_checklist(const char *title,
|
||||
}
|
||||
}
|
||||
}
|
||||
dlg_add_last_key(separate_output);
|
||||
}
|
||||
|
||||
dlg_free_columns(&listitems[0].text, (int) sizeof(DIALOG_LISTITEM), item_no);
|
||||
|
202
config.guess
vendored
202
config.guess
vendored
@ -2,9 +2,9 @@
|
||||
# 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,
|
||||
# 2911 Free Software Foundation, Inc.
|
||||
# 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2011-01-01'
|
||||
timestamp='2012-09-25'
|
||||
|
||||
# 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
|
||||
@ -17,9 +17,7 @@ timestamp='2011-01-01'
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
@ -57,7 +55,7 @@ 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, 2011
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
@ -145,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:NetBSD:*:*)
|
||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||
# switched to ELF, *-*-netbsd* would select the old
|
||||
# object file format. This provides both forward
|
||||
@ -202,6 +200,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit ;;
|
||||
*:Bitrig:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:OpenBSD:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
|
||||
@ -220,10 +222,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
exit ;;
|
||||
alpha:OSF1:*:*)
|
||||
case $UNAME_RELEASE in
|
||||
*4.0)
|
||||
*4.0)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
;;
|
||||
*5.*)
|
||||
*5.*)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
;;
|
||||
esac
|
||||
@ -304,7 +306,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
arm:riscos:*:*|arm:RISCOS:*:*)
|
||||
arm*:riscos:*:*|arm*:RISCOS:*:*)
|
||||
echo arm-unknown-riscos
|
||||
exit ;;
|
||||
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
|
||||
@ -600,50 +602,50 @@ EOF
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||
esac ;;
|
||||
esac
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
if [ "${HP_ARCH}" = "" ]; then
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
default: puts ("hppa2.0"); break;
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
default: puts ("hppa2.0"); break;
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||
@ -792,21 +794,26 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:FreeBSD:*:*)
|
||||
case ${UNAME_MACHINE} in
|
||||
pc98)
|
||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
case ${UNAME_PROCESSOR} in
|
||||
amd64)
|
||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
esac
|
||||
exit ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit ;;
|
||||
*:MINGW64*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw64
|
||||
exit ;;
|
||||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
i*:MSYS*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msys
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
# uname -m includes "-pc" on this system.
|
||||
echo ${UNAME_MACHINE}-mingw32
|
||||
@ -861,15 +868,22 @@ EOF
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
aarch64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
aarch64_be:Linux:*:*)
|
||||
UNAME_MACHINE=aarch64_be
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||
EV56) UNAME_MACHINE=alphaev56 ;;
|
||||
PCA56) UNAME_MACHINE=alphapca56 ;;
|
||||
PCA57) UNAME_MACHINE=alphapca56 ;;
|
||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||
EV56) UNAME_MACHINE=alphaev56 ;;
|
||||
PCA56) UNAME_MACHINE=alphapca56 ;;
|
||||
PCA57) UNAME_MACHINE=alphapca56 ;;
|
||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
@ -877,30 +891,39 @@ EOF
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null | \
|
||||
grep -q __ARM_EABI__
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_PCS_VFP
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
|
||||
fi
|
||||
fi
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
echo cris-axis-linux-gnu
|
||||
echo ${UNAME_MACHINE}-axis-linux-gnu
|
||||
exit ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo crisv32-axis-linux-gnu
|
||||
echo ${UNAME_MACHINE}-axis-linux-gnu
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo frv-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
hexagon:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
LIBC=gnu
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
@ -937,7 +960,7 @@ EOF
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
or32:Linux:*:*)
|
||||
echo or32-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
echo sparc-unknown-linux-gnu
|
||||
@ -972,13 +995,13 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
tile*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-tilera-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
vax:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||
exit ;;
|
||||
x86_64:Linux:*:*)
|
||||
echo x86_64-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
@ -1096,7 +1119,7 @@ EOF
|
||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
||||
OS_REL='.3'
|
||||
test -r /etc/.relid \
|
||||
@ -1139,8 +1162,8 @@ EOF
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit ;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
@ -1168,9 +1191,9 @@ EOF
|
||||
exit ;;
|
||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit ;;
|
||||
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
||||
@ -1185,6 +1208,9 @@ EOF
|
||||
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||
echo i586-pc-haiku
|
||||
exit ;;
|
||||
x86_64:Haiku:*:*)
|
||||
echo x86_64-unknown-haiku
|
||||
exit ;;
|
||||
SX-4:SUPER-UX:*:*)
|
||||
echo sx4-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@ -1215,12 +1241,12 @@ EOF
|
||||
i386)
|
||||
eval $set_cc_for_build
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
UNAME_PROCESSOR="x86_64"
|
||||
fi
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
UNAME_PROCESSOR="x86_64"
|
||||
fi
|
||||
fi ;;
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
@ -1229,8 +1255,8 @@ EOF
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
UNAME_PROCESSOR=`uname -p`
|
||||
if test "$UNAME_PROCESSOR" = "x86"; then
|
||||
UNAME_PROCESSOR=i386
|
||||
UNAME_MACHINE=pc
|
||||
UNAME_PROCESSOR=i386
|
||||
UNAME_MACHINE=pc
|
||||
fi
|
||||
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@ -1240,7 +1266,7 @@ EOF
|
||||
NEO-?:NONSTOP_KERNEL:*:*)
|
||||
echo neo-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSE-?:NONSTOP_KERNEL:*:*)
|
||||
NSE-*:NONSTOP_KERNEL:*:*)
|
||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSR-?:NONSTOP_KERNEL:*:*)
|
||||
@ -1309,11 +1335,11 @@ EOF
|
||||
i*86:AROS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-aros
|
||||
exit ;;
|
||||
x86_64:VMkernel:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-esx
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
@ -1331,11 +1357,11 @@ main ()
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
112
config.sub
vendored
112
config.sub
vendored
@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# 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
|
||||
# 2011 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2011-04-01'
|
||||
timestamp='2012-08-18'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@ -21,9 +21,7 @@ timestamp='2011-04-01'
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
@ -76,7 +74,7 @@ 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, 2011
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
@ -125,13 +123,17 @@ esac
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
android-linux)
|
||||
os=-linux-android
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
@ -223,6 +225,12 @@ case $os in
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*178)
|
||||
os=-lynxos178
|
||||
;;
|
||||
-lynx*5)
|
||||
os=-lynxos5
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
@ -247,17 +255,22 @@ case $basic_machine in
|
||||
# Some are omitted here because they have special meanings below.
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| aarch64 | aarch64_be \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||
| be32 | be64 \
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| epiphany \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | mcore | mep | metag \
|
||||
@ -291,7 +304,7 @@ case $basic_machine in
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| pyramid \
|
||||
| rx \
|
||||
| rl78 | rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
@ -300,7 +313,7 @@ case $basic_machine in
|
||||
| spu \
|
||||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e \
|
||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||
| we32k \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
@ -315,8 +328,7 @@ case $basic_machine in
|
||||
c6x)
|
||||
basic_machine=tic6x-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
||||
# Motorola 68HC11/12.
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
@ -325,21 +337,28 @@ case $basic_machine in
|
||||
ms1)
|
||||
basic_machine=mt-unknown
|
||||
;;
|
||||
|
||||
strongarm | thumb | xscale)
|
||||
basic_machine=arm-unknown
|
||||
;;
|
||||
xgate)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
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.
|
||||
i*86 | x86_64)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
@ -348,11 +367,13 @@ case $basic_machine in
|
||||
# Recognize the basic CPU types with company name.
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| aarch64-* | aarch64_be-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
@ -361,8 +382,10 @@ case $basic_machine in
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| hexagon-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| le32-* | le64-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
@ -396,7 +419,7 @@ case $basic_machine in
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* | rx-* \
|
||||
| rl78-* | 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-* \
|
||||
@ -404,10 +427,11 @@ case $basic_machine in
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile-* | tilegx-* \
|
||||
| tile*-* \
|
||||
| tron-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||
| vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
@ -707,7 +731,6 @@ case $basic_machine in
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i*86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
@ -768,6 +791,10 @@ case $basic_machine in
|
||||
microblaze)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-mingw64
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
@ -804,10 +831,18 @@ case $basic_machine in
|
||||
ms1-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
msys)
|
||||
basic_machine=i386-pc
|
||||
os=-msys
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
nacl)
|
||||
basic_machine=le32-unknown
|
||||
os=-nacl
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
@ -836,10 +871,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
|
||||
@ -958,11 +993,9 @@ case $basic_machine in
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power)
|
||||
basic_machine=power-ibm
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc | ppcbe)
|
||||
basic_machine=powerpc-unknown
|
||||
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-* | ppcbe-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
@ -973,11 +1006,9 @@ 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
|
||||
@ -1120,13 +1151,8 @@ case $basic_machine in
|
||||
basic_machine=t90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
# This must be matched before tile*.
|
||||
tilegx*)
|
||||
basic_machine=tilegx-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tile*)
|
||||
basic_machine=tile-unknown
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
@ -1330,15 +1356,15 @@ case $os in
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-uclibc* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
@ -1421,7 +1447,7 @@ case $os in
|
||||
-nova*)
|
||||
os=-rtmk-nova
|
||||
;;
|
||||
-ns2)
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
-nsk*)
|
||||
@ -1521,6 +1547,9 @@ case $basic_machine in
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
hexagon-*)
|
||||
os=-elf
|
||||
;;
|
||||
tic54x-*)
|
||||
os=-coff
|
||||
;;
|
||||
@ -1548,9 +1577,6 @@ case $basic_machine in
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
@ -1618,7 +1644,7 @@ case $basic_machine in
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next)
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
|
51
configure.in
51
configure.in
@ -1,7 +1,7 @@
|
||||
dnl $Id: configure.in,v 1.68 2011/10/20 21:02:43 tom Exp $
|
||||
dnl $Id: configure.in,v 1.75 2012/12/30 22:38:00 tom Exp $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Copyright 1999-2010,2011 -- Thomas E. Dickey
|
||||
dnl Copyright 1999-2011,2012 -- Thomas E. Dickey
|
||||
dnl
|
||||
dnl Permission is hereby granted, free of charge, to any person obtaining a
|
||||
dnl copy of this software and associated documentation files (the
|
||||
@ -27,7 +27,7 @@ dnl holders shall not be used in advertising or otherwise to promote the
|
||||
dnl sale, use or other dealings in this Software without prior written
|
||||
dnl authorization.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_PREREQ(2.13.20020210)
|
||||
AC_PREREQ(2.52.20011201)
|
||||
AC_INIT(dialog.h)
|
||||
AC_CONFIG_HEADER(dlg_config.h:config.hin)
|
||||
|
||||
@ -39,9 +39,8 @@ AC_SUBST(DESTDIR)
|
||||
dnl
|
||||
dnl Checks for programs.
|
||||
dnl
|
||||
AC_PROG_CC
|
||||
CF_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
@ -50,9 +49,6 @@ CF_PROG_LINT
|
||||
dnl needed for CF_WITH_LIBTOOL
|
||||
AC_CHECK_TOOL(AR, ar, ar)
|
||||
|
||||
AC_ISC_POSIX
|
||||
AC_C_CONST
|
||||
|
||||
CF_MAKEFLAGS
|
||||
CF_MAKE_TAGS
|
||||
CF_DISABLE_ECHO
|
||||
@ -95,7 +91,7 @@ CF_ARG_MSG_ENABLE([if you want --trace option],
|
||||
trace,
|
||||
[ --disable-trace do not support --trace option],
|
||||
[EXTRAOBJS="$EXTRAOBJS trace\$o"
|
||||
AC_DEFINE(HAVE_DLG_TRACE)],,yes)
|
||||
AC_DEFINE(HAVE_DLG_TRACE,1,[Define to 1 to support --trace option])],,yes)
|
||||
|
||||
LIBTOOL_MAKE="#"
|
||||
CF_WITH_LIBTOOL
|
||||
@ -136,48 +132,59 @@ CF_ARG_MSG_ENABLE([if you want config-file support],
|
||||
rc-file,
|
||||
[ --disable-rc-file do not include config-file support],
|
||||
[EXTRAOBJS="$EXTRAOBJS rc\$o"
|
||||
AC_DEFINE(HAVE_RC_FILE)],,$cf_all_widgets)
|
||||
AC_DEFINE(HAVE_RC_FILE,1,[Define to 1 to include config-file support])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want Xdialog-style dialogs],
|
||||
Xdialog,
|
||||
[ --disable-Xdialog do not include Xdialog-style dialogs],
|
||||
[ --disable-Xdialog do not include Xdialog-style dialogs (1.1)],
|
||||
[EXTRAOBJS="$EXTRAOBJS calendar\$o fselect\$o timebox\$o"
|
||||
AC_DEFINE(HAVE_XDIALOG)],,$cf_all_widgets)
|
||||
AC_DEFINE(HAVE_XDIALOG,1,[Define to 1 to include Xdialog-style dialogs])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want extra Xdialog-style dialogs (1.2)],
|
||||
Xdialog2,
|
||||
[ --disable-Xdialog2 do not include extra Xdialog-style dialogs (1.2)],
|
||||
[EXTRAOBJS="$EXTRAOBJS buildlist\$o rangebox\$o treeview\$o"
|
||||
AC_DEFINE(HAVE_XDIALOG2,1,[Define to 1 to include extra Xdialog-style dialogs])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want compatibility with whiptail options],
|
||||
whiptail,
|
||||
[ --disable-whiptail do not map extra whiptail options],
|
||||
[AC_DEFINE(HAVE_WHIPTAIL,1,[Define to 1 to include extra whiptail options])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the form dialog],
|
||||
form,
|
||||
[ --disable-form do not include the form dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS formbox\$o"
|
||||
AC_DEFINE(HAVE_DLG_FORMBOX)],,$cf_all_widgets)
|
||||
AC_DEFINE(HAVE_DLG_FORMBOX,1,[Define to 1 to include the form dialog])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the gauge dialog],
|
||||
gauge,
|
||||
[ --disable-gauge do not include the gauge dialogs],
|
||||
[EXTRAOBJS="$EXTRAOBJS guage\$o pause\$o prgbox\$o progressbox\$o"
|
||||
AC_DEFINE(HAVE_DLG_GAUGE)],,$cf_all_widgets)
|
||||
AC_DEFINE(HAVE_DLG_GAUGE,1,[Define to 1 to include the gauge dialogs])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the tailbox dialog],
|
||||
tailbox,
|
||||
[ --disable-tailbox do not include the tailbox dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS tailbox\$o"
|
||||
AC_DEFINE(HAVE_DLG_TAILBOX)],,$cf_all_widgets)
|
||||
AC_DEFINE(HAVE_DLG_TAILBOX,1,[Define to 1 to include the tailbox dialog])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the mixedform dialog],
|
||||
mixedform,
|
||||
[ --disable-mixedform do not include the mixedform dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS mixedform\$o"
|
||||
AC_DEFINE(HAVE_DLG_MIXEDFORM)],,$cf_all_widgets)
|
||||
AC_DEFINE(HAVE_DLG_MIXEDFORM,1,[Define to 1 to include the mixedform dialog])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the mixedgauge dialog],
|
||||
mixedgauge,
|
||||
[ --disable-mixedgauge do not include the mixedgauge dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS mixedgauge\$o"
|
||||
AC_DEFINE(HAVE_MIXEDGAUGE)],,$cf_all_widgets)
|
||||
AC_DEFINE(HAVE_MIXEDGAUGE,1,[Define to 1 to include the mixedgauge dialog])],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the wide-curses features],
|
||||
widec,
|
||||
[ --enable-widec enable wide-curses features],
|
||||
[AC_DEFINE(USE_WIDE_CURSES)],,$cf_wide_curses)
|
||||
[AC_DEFINE(USE_WIDE_CURSES,1,[Define to 1 to enable wide-curses features])],,$cf_wide_curses)
|
||||
|
||||
AC_SUBST(EXTRAOBJS)
|
||||
|
||||
@ -227,10 +234,12 @@ getpary \
|
||||
getparyx \
|
||||
use_default_colors \
|
||||
wchgat \
|
||||
wcursyncup \
|
||||
wget_wch \
|
||||
wsyncup \
|
||||
)
|
||||
|
||||
AC_CHECK_FUNC(start_color,[AC_DEFINE(HAVE_COLOR)])
|
||||
AC_CHECK_FUNC(start_color,[AC_DEFINE(HAVE_COLOR,1,[Define to 1 if (n)curses has start_color function])])
|
||||
CF_CURSES_CHTYPE
|
||||
CF_CURSES_WACS_SYMBOLS
|
||||
CF_CURSES_WGETPARENT
|
||||
@ -239,8 +248,8 @@ CF_MBSTATE_T
|
||||
|
||||
CF_HEADERS_SH(DLG,dlg_config.h)
|
||||
|
||||
AC_TRY_LINK([#include <locale.h>],[setlocale(LC_ALL, "")],[AC_DEFINE(HAVE_SETLOCALE)])
|
||||
AC_TRY_LINK([#include <locale.h>],[setlocale(LC_ALL, "")],[AC_DEFINE(HAVE_SETLOCALE,1,[Define to 1 if locale feature can be enabled])])
|
||||
|
||||
CF_DISABLE_RPATH_HACK
|
||||
|
||||
AC_OUTPUT(dialog-config makefile $EXTRA_OUTPUT $SUB_MAKEFILE samples/install/makefile,,,sort -u)
|
||||
AC_OUTPUT(dialog-config makefile $EXTRA_OUTPUT $SUB_MAKEFILE,,,sort -u)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!@SHELL@
|
||||
# $Id: dialog-config.in,v 1.5 2011/01/06 09:38:03 tom Exp $
|
||||
# $Id: dialog-config.in,v 1.6 2012/10/06 14:29:45 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 2007,2011 Thomas E. Dickey #
|
||||
# Copyright (c) 2007-2011,2012 Thomas E. Dickey #
|
||||
# #
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a #
|
||||
# copy of this software and associated documentation files (the "Software"), #
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
prefix="@prefix@"
|
||||
exec_prefix="@exec_prefix@"
|
||||
datarootdir="@datarootdir@"
|
||||
|
||||
bindir="@bindir@"
|
||||
libdir="@libdir@"
|
||||
|
237
dialog.1
237
dialog.1
@ -1,6 +1,6 @@
|
||||
'\" t
|
||||
.\" $Id: dialog.1,v 1.145 2012/07/03 08:32:33 tom Exp $
|
||||
.\" Copyright 2005-2011,2012 Thomas E. Dickey
|
||||
.\" $Id: dialog.1,v 1.165 2013/03/15 09:07:30 tom Exp $
|
||||
.\" Copyright 2005-2012,2013 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
|
||||
@ -36,10 +36,14 @@
|
||||
.fi
|
||||
.RE
|
||||
..
|
||||
.\" Bulleted paragraph
|
||||
.de bP
|
||||
.IP \(bu 4
|
||||
..
|
||||
.
|
||||
.TH \*D 1 "" "$Date: 2012/07/03 08:32:33 $"
|
||||
.TH \*D 1 "" "$Date: 2013/03/15 09:07:30 $"
|
||||
.SH NAME
|
||||
\*p \- display dialog boxes from shell scripts
|
||||
dialog \- display dialog boxes from shell scripts
|
||||
.SH SYNOPSIS
|
||||
\fB\*p --clear\fP
|
||||
.br
|
||||
@ -60,6 +64,7 @@ These types of dialog boxes are implemented
|
||||
.LP
|
||||
.nh
|
||||
.na
|
||||
.BR buildlist ", "
|
||||
.BR calendar ", "
|
||||
.BR checklist ", "
|
||||
.BR dselect ", "
|
||||
@ -81,22 +86,22 @@ These types of dialog boxes are implemented
|
||||
.BR programbox ", "
|
||||
.BR progressbox ", "
|
||||
.BR radiolist ", "
|
||||
.BR rangebox ", "
|
||||
.BR tailbox ", "
|
||||
.BR tailboxbg ", "
|
||||
.BR textbox ", "
|
||||
.BR timebox ", and "
|
||||
.BR timebox ", "
|
||||
.BR treeview ", and "
|
||||
.BR yesno " (yes/no)."
|
||||
.ad
|
||||
.hy
|
||||
.RE
|
||||
.PP
|
||||
You can put more than one dialog box into a script:
|
||||
.TP 5
|
||||
-
|
||||
.bP
|
||||
Use the "\fB--and-widget\fP" token to force \fB\*p\fP to proceed to the next
|
||||
dialog unless you have pressed ESC to cancel, or
|
||||
.TP 5
|
||||
-
|
||||
.bP
|
||||
Simply add the tokens for the next dialog box, making a chain.
|
||||
\*L stops chaining when the return code from a dialog is nonzero,
|
||||
e.g., Cancel or No (see DIAGNOSTICS).
|
||||
@ -379,6 +384,12 @@ marked with "\fB--keep-window\fR", even if they are not \fBtailboxbg\fR widgets.
|
||||
That causes them to be repainted in reverse order.
|
||||
See the discussion of the "\fB--clear\fR" option for examples.
|
||||
.
|
||||
.IP "\fB--last-key"
|
||||
At exit, report the last key which the user entered.
|
||||
This is the curses key code rather than a symbol or literal character.
|
||||
It can be used by scripts to distinguish between two keys which are
|
||||
bound to the same action.
|
||||
.
|
||||
.IP "\fB--max-input \fIsize"
|
||||
Limit input strings to the given size.
|
||||
If not specified, the limit is 2048.
|
||||
@ -395,6 +406,16 @@ Use this option to disable that feature.
|
||||
Note that \fB\*p\fR will still wrap text,
|
||||
subject to the "\fB--cr-wrap\fR" and "\fB--trim\fR" options.
|
||||
.
|
||||
.IP "\fB--no-items"
|
||||
Some widgets (checklist, inputmenu, radiolist, menu) display a list
|
||||
with two columns (a "tag" and "item", i.e., "description").
|
||||
This option tells \fB\*p\fP to read shorter rows,
|
||||
omitting the "item" part of the list.
|
||||
This is occasionally useful, e.g., if the tags provide enough information.
|
||||
.IP
|
||||
See also \fB--no-tags\fP.
|
||||
If both options are given, this one is ignored.
|
||||
.
|
||||
.IP "\fB--no-kill"
|
||||
Tells
|
||||
\fB\*p\fP
|
||||
@ -423,10 +444,27 @@ literal newlines.
|
||||
Suppress the "OK" button in checklist, inputbox and menu box modes.
|
||||
A script can still test if the user pressed the "Enter" key to accept the data.
|
||||
.
|
||||
.
|
||||
.IP "\fB--no-shadow"
|
||||
Suppress shadows that would be drawn to the right and bottom of each dialog box.
|
||||
.
|
||||
.IP "\fB--no-tags"
|
||||
Some widgets (checklist, inputmenu, radiolist, menu) display a list
|
||||
with two columns (a "tag" and "description").
|
||||
The tag is useful for scripting, but may not help the user.
|
||||
The \fB--no-tags\fP option (from Xdialog) may be used to suppress the
|
||||
column of tags from the display.
|
||||
Unlike the \fB--no-items\fP option,
|
||||
this does not affect the data which is read from the script.
|
||||
.IP
|
||||
Xdialog does not display the tag column for the analogous buildlist
|
||||
and treeview widgets; \fB\*p\fP does the same.
|
||||
.IP
|
||||
Normally \fB\*p\fP allows you to quickly move to entries on the displayed list,
|
||||
by matching a single character to the first character of the tag.
|
||||
When the \fB--no-tags\fP option is given, \fB\*p\fP matches against
|
||||
the first character of the description.
|
||||
In either case, the matchable character is highlighted.
|
||||
.
|
||||
.IP "\fB--ok-label \fIstring"
|
||||
Override the label used for "OK" buttons.
|
||||
.
|
||||
@ -563,7 +601,7 @@ 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
|
||||
Modify the tab-traversal of checklist, radiolist, menubox and inputmenu
|
||||
to include the list of items as one of the states.
|
||||
This is useful as a visual aid,
|
||||
i.e., the cursor position helps some users.
|
||||
@ -591,6 +629,44 @@ the width of the dialog box.
|
||||
Other parameters depend on the box type.
|
||||
.
|
||||
.
|
||||
.IP "\fB--buildlist \fItext height width \fR[ \fItag item status \fR] \fI..."
|
||||
A \fBbuildlist\fP dialog displays two lists, side-by-side.
|
||||
The list on the left shows unselected items.
|
||||
The list on the right shows selected items.
|
||||
As items are selected or unselected, they move between the lists.
|
||||
.IP
|
||||
Use a carriage return or the "OK" button to accept the current value
|
||||
in the selected-window and exit.
|
||||
The results are written using the order displayed in the selected-window.
|
||||
.IP
|
||||
The initial on/off state of each entry is specified by
|
||||
.IR status "."
|
||||
.IP
|
||||
The dialog behaves like a \fBmenu\fP, using the \fB--visit-items\fP
|
||||
to control whether the cursor is allowed to visit the lists directly.
|
||||
.RS
|
||||
.bP
|
||||
If \fB--visit-items\fP is not given,
|
||||
tab-traversal uses two states (OK/Cancel).
|
||||
.bP
|
||||
If \fB--visit-items\fP is given,
|
||||
tab-traversal uses four states (Left/Right/OK/Cancel).
|
||||
.RE
|
||||
.IP
|
||||
Whether or not \fB--visit--items\fP is given,
|
||||
it is possible to move the highlight between the two lists using
|
||||
the default "^" (left-column) and "$" (right-column) keys.
|
||||
.IP
|
||||
On exit, a list of the \fItag\fP
|
||||
strings of those entries that are turned on
|
||||
will be printed on \fB\*p\fP's output.
|
||||
.IP
|
||||
If the "\fB--separate-output\fP" option is not given,
|
||||
the strings will be quoted as needed to make it simple for scripts to separate them.
|
||||
By default, this uses double-quotes.
|
||||
See the "\fB--single-quoted\fP" option, which modifies the quoting behavior.
|
||||
.
|
||||
.
|
||||
.IP "\fB--calendar \fItext height width day month year"
|
||||
A \fBcalendar\fP box displays
|
||||
month, day and year in separately adjustable windows.
|
||||
@ -679,16 +755,13 @@ The former defines the length shown for a selected field,
|
||||
while the latter defines the permissible length of the data entered in the
|
||||
field.
|
||||
.RS
|
||||
.TP 3
|
||||
-
|
||||
.bP
|
||||
If \fIflen\fR is zero, the corresponding field cannot be altered.
|
||||
and the contents of the field determine the displayed-length.
|
||||
.TP 3
|
||||
-
|
||||
.bP
|
||||
If \fIflen\fR is negative, the corresponding field cannot be altered,
|
||||
and the negated value of \fIflen\fR is used as the displayed-length.
|
||||
.TP 3
|
||||
-
|
||||
.bP
|
||||
If \fIilen\fR is zero, it is set to \fIflen\fR.
|
||||
.RE
|
||||
.IP
|
||||
@ -976,7 +1049,7 @@ The only difference is
|
||||
that you can indicate which entry is currently selected, by setting its
|
||||
.IR status " to " on "."
|
||||
.IP
|
||||
On exit, the name of the selected item is written to \fB\*p\fP's output.
|
||||
On exit, the tag of the selected item is written to \fB\*p\fP's output.
|
||||
.
|
||||
.
|
||||
.IP "\fB--tailbox \fIfile height width"
|
||||
@ -989,6 +1062,36 @@ Only an "OK" button is provided for input,
|
||||
but an ESC exit status may be returned.
|
||||
.
|
||||
.
|
||||
.nf
|
||||
.IP "\fB--rangebox \fItext height width list-height min-value max-value default-value"
|
||||
.fi
|
||||
Allow the user to select from a range of values, e.g., using a slider.
|
||||
The dialog shows the current value as a bar (like the gauge dialog).
|
||||
Tabs or arrow keys move the cursor between the buttons and the value.
|
||||
When the cursor is on the value,
|
||||
you can edit it by:
|
||||
.RS
|
||||
.TP 5
|
||||
left/right cursor movement to select a digit to modify
|
||||
.TP 5
|
||||
+/-
|
||||
characters to increment/decrement the digit by one
|
||||
.TP 5
|
||||
0 through 9
|
||||
to set the digit to the given value
|
||||
.RE
|
||||
.IP
|
||||
Some keys are also recognized in all cursor positions:
|
||||
.RS
|
||||
.TP 5
|
||||
home/end
|
||||
set the value to its maximum or minimum
|
||||
.TP 5
|
||||
pageup/pagedown
|
||||
increment the value so that the slider moves by one column
|
||||
.RE
|
||||
.
|
||||
.
|
||||
.IP "\fB--tailboxbg \fIfile height width"
|
||||
Display text from a file in a dialog box as a background task,
|
||||
as in a "tail -f &" command.
|
||||
@ -1054,6 +1157,19 @@ On exit, the result is printed in the form hour:minute:second.
|
||||
The format can be overridden using the \fB--time-format\fP option.
|
||||
.
|
||||
.
|
||||
.IP "\fB--treeview \fItext height width list-height \fR[ \fItag item status depth \fR] \fI..."
|
||||
Display data organized as a tree.
|
||||
Each group of data contains a tag,
|
||||
the text to display for the item,
|
||||
its status ("on" or "off")
|
||||
and the depth of the item in the tree.
|
||||
.IP
|
||||
Only one item can be selected (like the \fBradiolist\fP).
|
||||
The tag is not displayed.
|
||||
.IP
|
||||
On exit, the tag of the selected item is written to \fB\*p\fP's output.
|
||||
.
|
||||
.
|
||||
.IP "\fB--yesno \fItext height width"
|
||||
A \fByes/no\fP dialog box of
|
||||
size \fIheight\fP rows by \fIwidth\fP columns will be displayed.
|
||||
@ -1330,14 +1446,12 @@ or \fB\*p\fP is exited by pressing the \fIESC\fP key (DIALOG_ESC).
|
||||
\fB\*L\fP works with X/Open curses.
|
||||
However, some implementations have deficiencies:
|
||||
.RS 3
|
||||
.TP 3
|
||||
-
|
||||
.bP
|
||||
HPUX curses (and perhaps others) do not open the terminal properly for
|
||||
the \fInewterm\fP function.
|
||||
This interferes with \fB\*p\fP's \fB--input-fd\fP option,
|
||||
by preventing cursor-keys and similar escape sequences from being recognized.
|
||||
.TP 3
|
||||
-
|
||||
.bP
|
||||
NetBSD 5.1 curses has incomplete support for wide-characters.
|
||||
\fB\*p\fP will build, but not all examples display properly.
|
||||
.RE
|
||||
@ -1390,10 +1504,25 @@ l l.
|
||||
.RE
|
||||
.PP
|
||||
\fBXdialog\fP's manpage has a section discussing its compatibility with \fB\*p\fP.
|
||||
There are some differences not shown in the manpage.
|
||||
For example, the html documentation states
|
||||
.RS
|
||||
.PP
|
||||
Note: former Xdialog releases used the "\n" (line feed) as a
|
||||
results separator for the checklist widget; this has been
|
||||
changed to "/" in Xdialog v1.5.0 so to make it compatible with
|
||||
(c)dialog. In your old scripts using the Xdialog checklist, you
|
||||
will then have to add the --separate-output option before the
|
||||
--checklist one.
|
||||
.RE
|
||||
.PP
|
||||
\fB\*L\fP has not used a different separator;
|
||||
the difference was likely due to confusion regarding some script.
|
||||
.SS WHIPTAIL
|
||||
Then there is \fBwhiptail\fP.
|
||||
For practical purposes, it is maintained by Debian.
|
||||
Its documentation claims
|
||||
For practical purposes, it is maintained by Debian
|
||||
(very little work is done by its upstream developers).
|
||||
Its documentation (README.whiptail) claims
|
||||
.RS
|
||||
.sp
|
||||
.nf
|
||||
@ -1416,18 +1545,24 @@ The comparable number for \fB\*p\fP (counting ncurses) is 520kb.
|
||||
Disregard the first paragraph.
|
||||
.PP
|
||||
The second paragraph is misleading, since \fBwhiptail\fP
|
||||
also does not work for common options of \*p, such as the gauge box.
|
||||
\fBwhiptail\fP is less compatible with \fB\*p\fP than the decade-old
|
||||
original dialog 0.4 program.
|
||||
also does not work for common options of \fB\*p\fP,
|
||||
such as the gauge box.
|
||||
\fBwhiptail\fP is less compatible with \fB\*p\fP than the
|
||||
original mid-1990s dialog 0.4 program.
|
||||
.PP
|
||||
\fBwhiptail\fP's manpage borrows features from \fB\*p\fP, e.g.,
|
||||
\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.
|
||||
but oddly cites only \fB\*p\fP versions up to 0.4 (1994) 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 (2008).
|
||||
.bP
|
||||
\fB--gauge\fP (from 0.5)
|
||||
.bP
|
||||
\fB--passwordbox\fP (from Debian changes in 1999),
|
||||
.bP
|
||||
\fB--default-item\fP (from \fB\*p\fP 2000/02/22),
|
||||
.bP
|
||||
\fB--output-fd\fP (from \fB\*p\fP 2002/08/14).
|
||||
.PP
|
||||
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
|
||||
@ -1445,12 +1580,38 @@ l l
|
||||
_ _
|
||||
l l.
|
||||
\fIOption\fR \fITreatment\fR
|
||||
\fB--cancel-button\fP mapped to \fB--cancel-label\fP
|
||||
\fB--fb\fP ignored
|
||||
\fB--fullbutton\fP ignored
|
||||
\fB--no-button\fP mapped to \fB--no-label\fP
|
||||
\fB--nocancel\fP mapped to \fB--no-cancel\fP
|
||||
\fB--noitem\fP ignored
|
||||
\fB--noitem\fP mapped to \fB--no-items\fP
|
||||
\fB--notags\fP mapped to \fB--no-tags\fP
|
||||
\fB--ok-button\fP mapped to \fB--ok-label\fP
|
||||
\fB--scrolltext\fP mapped to \fB--scrollbar\fP
|
||||
\fB--topleft\fP mapped to \fB--begin 0 0\fP
|
||||
\fB--yes-button\fP mapped to \fB--yes-label\fP
|
||||
.TE
|
||||
.RE
|
||||
.LP
|
||||
There are visual differences which are not addressed by command-line options:
|
||||
.bP
|
||||
\fB\*p\fP centers lists within the window.
|
||||
\fBwhiptail\fP typically puts lists against the left margin.
|
||||
.bP
|
||||
\fBwhiptail\fP uses angle brackets ("<" and ">") for marking buttons.
|
||||
\fB\*p\fP uses square brackets.
|
||||
.bP
|
||||
\fBwhiptail\fP marks the limits of subtitles with vertical bars.
|
||||
\fB\*p\fP does not mark the limits.
|
||||
.bP
|
||||
\fBwhiptail\fP attempts to mark the top/bottom cells of a scrollbar
|
||||
with up/down arrows.
|
||||
When it cannot do this,
|
||||
it fills those cells with the background color
|
||||
of the scrollbar and confusing the user.
|
||||
\fB\*p\fP uses the entire scrollbar space,
|
||||
thereby getting better resolution.
|
||||
.\" ************************************************************************
|
||||
.SH BUGS
|
||||
Perhaps.
|
||||
@ -1469,13 +1630,11 @@ Yura Kalinichenko adapted the gauge widget as "pause".
|
||||
This is a rewrite (except as needed to provide compatibility)
|
||||
of the earlier version of \fB\*p 0.9a\fP,
|
||||
which lists as authors:
|
||||
.RS
|
||||
.LP
|
||||
.bP
|
||||
Savio Lam - version 0.3, "dialog"
|
||||
.LP
|
||||
.bP
|
||||
Stuart Herbert - patch for version 0.4
|
||||
.LP
|
||||
.bP
|
||||
Marc Ewing - the gauge widget.
|
||||
.LP
|
||||
.bP
|
||||
Pasquale De Marco "Pako" - version 0.9a, "cdialog"
|
||||
.RE
|
||||
|
407
dialog.3
407
dialog.3
@ -1,5 +1,6 @@
|
||||
.\" $Id: dialog.3,v 1.76 2012/07/03 08:22:10 tom Exp $
|
||||
.\" Copyright 2005-2011,2012 Thomas E. Dickey
|
||||
'\" t
|
||||
.\" $Id: dialog.3,v 1.91 2013/03/15 09:07:30 tom Exp $
|
||||
.\" Copyright 2005-2012,2013 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
|
||||
@ -38,9 +39,9 @@
|
||||
.de bP
|
||||
.IP \(bu 4
|
||||
..
|
||||
.TH \*D 3 "" "$Date: 2012/07/03 08:22:10 $"
|
||||
.TH \*D 3 "" "$Date: 2013/03/15 09:07:30 $"
|
||||
.SH NAME
|
||||
\*l \- widgets and utilities for the \*p program
|
||||
dialog \- widgets and utilities for the \*p program
|
||||
.SH SYNOPSIS
|
||||
.B cc [ flag ... ] file ... -l\*l [ library ... ]
|
||||
.br
|
||||
@ -432,7 +433,7 @@ 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.
|
||||
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".
|
||||
@ -456,11 +457,21 @@ This is useful for keeping the window contents visible when several
|
||||
widgets are run in the same process.
|
||||
Note that curses will clear the screen when starting a new process.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.IP \fIDIALOG_VARS.last_key
|
||||
This corresponds to the command-line option "\fB--last-key\fP".
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.IP \fIDIALOG_VARS.max_input
|
||||
This corresponds to the command-line option "\fB--max-input\fP \fIsize\fP".
|
||||
Limit input strings to the given size.
|
||||
If not specified, the limit is 2048.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.IP \fIDIALOG_VARS.no_items
|
||||
This corresponds to the command-line option "\fB--no-items\fP".
|
||||
Some widgets (checklist, inputmenu, radiolist, menu) display a list
|
||||
with two columns (a "tag" and "item", i.e., "description").
|
||||
This tells \fB\*p\fP to read shorter rows from data,
|
||||
omitting the "list".
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.IP \fIDIALOG_VARS.no_label
|
||||
This corresponds to the command-line option "\fB--no-label\fP \fIstring\fP".
|
||||
The given string overrides the label used for "No" buttons.
|
||||
@ -475,6 +486,63 @@ 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.no_tags
|
||||
This corresponds to the command-line option "\fB--no-tags\fP".
|
||||
Some widgets (checklist, inputmenu, radiolist, menu) display a list
|
||||
with two columns (a "tag" and "item", also known as "description").
|
||||
The tag is useful for scripting, but may not help the user.
|
||||
The \fB--no-tags\fP option (from Xdialog) may be used to suppress the
|
||||
column of tags from the display.
|
||||
.IP
|
||||
Normally \fB\*p\fP allows you to quickly move to entries on the displayed list,
|
||||
by matching a single character to the first character of the tag.
|
||||
When the \fB--no-tags\fP option is given, \fB\*p\fP matches against
|
||||
the first character of the description.
|
||||
In either case, the matchable character is highlighted.
|
||||
.IP
|
||||
Here is a table showing how the no_tags and no_items values interact:
|
||||
.TS
|
||||
tab(/);
|
||||
l l l l l
|
||||
_ _ _ _ _
|
||||
l l l c c.
|
||||
Widget/Fields Shown/Fields Read/.no_items/.no_tags
|
||||
buildlist/item/tag,item/0/0*
|
||||
buildlist/item/tag,item/0/1
|
||||
buildlist/tag/tag/1/0*
|
||||
buildlist/tag/tag/1/1
|
||||
checklist/tag,item/tag,item/0/0
|
||||
checklist/item/tag,item/0/1
|
||||
checklist/tag/tag/1/0
|
||||
checklist/tag/tag/1/1
|
||||
inputmenu/tag,item/tag,item/0/0
|
||||
inputmenu/item/tag,item/0/1
|
||||
inputmenu/tag/tag/1/0
|
||||
inputmenu/tag/tag/1/1
|
||||
menu/tag,item/tag,item/0/0
|
||||
menu/item/tag,item/0/1
|
||||
menu/tag/tag/1/0
|
||||
menu/tag/tag/1/1
|
||||
radiolist/tag,item/tag,item/0/0
|
||||
radiolist/item/tag,item/0/1
|
||||
radiolist/tag/tag/1/0
|
||||
radiolist/tag/tag/1/1
|
||||
treeview/item/tag,item/0/0*
|
||||
treeview/item/tag,item/0/1
|
||||
treeview/tag/tag/1/0*
|
||||
treeview/tag/tag/1/1
|
||||
_
|
||||
.TE
|
||||
.RS
|
||||
.TP 2
|
||||
*
|
||||
Xdialog does not display the tag column for the analogous buildlist
|
||||
and treeview widgets.
|
||||
\fB\*L\fP does the same on the command-line.
|
||||
However the library interface defaults to displaying the tag column.
|
||||
Your application can enable or disable the tag column as needed for each widget.
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.IP \fIDIALOG_VARS.nocancel
|
||||
This corresponds to the command-line option "\fB--no-cancel\fP".
|
||||
If true,
|
||||
@ -560,7 +628,8 @@ trim literal newlines and repeated blanks from message text.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.IP \fIDIALOG_VARS.visit_items
|
||||
This corresponds to the command-line option "\fB--visit-items\fP".
|
||||
Modify the tab-traversal of checklist, radiobox, menubox and inputmenu
|
||||
Modify the tab-traversal of the list-oriented widgets
|
||||
(buildlist, checklist, radiobox, menubox, inputmenu, and treeview)
|
||||
to include the list of items as one of the states.
|
||||
This is useful as a visual aid,
|
||||
i.e., the cursor position helps some users.
|
||||
@ -589,6 +658,49 @@ the width of the dialog box.
|
||||
Other parameters depend on the box type.
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.IP \fBdialog_buildlist
|
||||
implements the "\fB--buildlist\fP" option.
|
||||
.RS
|
||||
.TP 5
|
||||
.B const char * \fItitle
|
||||
is the title on 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 \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.
|
||||
.TP 5
|
||||
.B int \fIitem_no
|
||||
is the number of rows in \fIitems\fP.
|
||||
.TP 5
|
||||
.B char ** \fIitems
|
||||
is an array of strings which is viewed either as a list of rows
|
||||
.RS
|
||||
\fItag item status \fR
|
||||
.RE
|
||||
.IP
|
||||
or
|
||||
.RS
|
||||
\fItag item status help\fR
|
||||
.RE
|
||||
.IP
|
||||
depending on whether \fBdialog_vars.item_help\fP is set.
|
||||
.TP 5
|
||||
.B int \fIorder_mode
|
||||
is reserved for future enhancements
|
||||
.RE
|
||||
.
|
||||
.\" ************************************************************************
|
||||
.IP \fBdialog_calendar
|
||||
implements the "\fB--calendar\fP" option.
|
||||
.RS
|
||||
@ -764,7 +876,7 @@ If zero, the height is based on the screen size.
|
||||
.\" ************************************************************************
|
||||
.IP \fBdialog_gauge
|
||||
implements the "\fB--gauge\fP" option.
|
||||
Alternatively, a simpler or customized gauge widget can be
|
||||
Alternatively, a simpler or customized gauge widget can be
|
||||
setup using
|
||||
\fBdlg_allocate_gauge\fP,
|
||||
\fBdlg_update_gauge\fP and
|
||||
@ -1068,6 +1180,35 @@ is the desired width of the box.
|
||||
If zero, the height is based on the screen size.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP \fBdialog_rangebox
|
||||
implements the "\fB--rangebox\fP" option.
|
||||
.RS
|
||||
.TP 5
|
||||
.B const char * \fItitle
|
||||
is the title on the top of the widget.
|
||||
.TP 5
|
||||
.B const char * \fIcprompt
|
||||
is the prompt text shown within the widget.
|
||||
If empty or null, no prompt is shown.
|
||||
.TP 5
|
||||
.B int \fIheight
|
||||
is the desired height of the widget.
|
||||
If zero, the height is based on the screen size.
|
||||
.TP 5
|
||||
.B int \fIwidth
|
||||
is the desired width of the widget.
|
||||
If zero, the height is based on the screen size.
|
||||
.TP 5
|
||||
.B int \fImin_value
|
||||
is the minimum value to allow.
|
||||
.TP 5
|
||||
.B int \fImax_value
|
||||
is the maximum value to allow.
|
||||
.TP 5
|
||||
.B int \fIdefault_value
|
||||
is the default value, if no change is made.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP \fBdialog_tailbox
|
||||
implements the "\fB--tailbox\fP" or "\fB--tailboxbg\fP" option
|
||||
depending on whether \fIbg_task\fP is set.
|
||||
@ -1148,6 +1289,42 @@ 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.
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP \fBdialog_treeview
|
||||
implements the "\fB--treeview\fP" option.
|
||||
.RS
|
||||
.TP 5
|
||||
.B const char * \fItitle
|
||||
is the title on 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 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.
|
||||
.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.
|
||||
.TP 5
|
||||
.B int \fIitem_no
|
||||
is the number of rows in \fIitems\fP.
|
||||
.TP 5
|
||||
.B char ** \fIitems
|
||||
is the list of items, contain tag, name, and optionally help strings
|
||||
(if \fBdialog_vars.item_help\fP is set).
|
||||
The initial selection state for each item is also in this list.
|
||||
.TP 5
|
||||
.B int \fIflag
|
||||
.IP flag
|
||||
is either \fIFLAG_CHECK\fP, for checklists (multiple selections),
|
||||
or \fIFLAG_RADIO\fP for radiolists (a single selection).
|
||||
.RE
|
||||
.\" ************************************************************************
|
||||
.IP \fBdialog_yesno
|
||||
implements the "\fB--yesno\fP" option.
|
||||
.RS
|
||||
@ -1209,6 +1386,31 @@ function to call when input ends, e.g., to free caller's additional data.
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_add_last_key
|
||||
Report the last key entered by the user.
|
||||
This implements the \fB\-\-last\-key\fP command-line option,
|
||||
using \fBdialog_vars.last_key\fP.
|
||||
.RS
|
||||
.TP 5
|
||||
.B int \fImode
|
||||
controls the way the last key report is separated from other results:
|
||||
.RS
|
||||
.TP 5
|
||||
-2
|
||||
(no separator)
|
||||
.TP 5
|
||||
-1
|
||||
(separator after the key name)
|
||||
.TP 5
|
||||
0
|
||||
(separator is optionally before the key name)
|
||||
.TP 5
|
||||
1
|
||||
(same as -1)
|
||||
.RE
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_add_quoted
|
||||
Add a quoted string to the result buffer (see \fBdlg_add_result\fP).
|
||||
If no quotes are necessary, none are used.
|
||||
@ -1233,7 +1435,7 @@ is the string to add.
|
||||
.B dlg_add_separator
|
||||
Add an output-separator to the result buffer \fBdialog_vars.input_result\fP.
|
||||
If \fBdialog_vars.output_separator\fP is set, use that.
|
||||
Otherwise, if \fBdialog_vars.separate_output\fP is set, use newline.
|
||||
Otherwise, if \fBdialog_vars.separate_output\fP is set, use newline.
|
||||
If neither is set, use a space.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
@ -1387,17 +1589,13 @@ this calls \fBbeep\fP once and sets
|
||||
.B dlg_boxchar
|
||||
returns its \fBchtype\fP parameter transformed as follows:
|
||||
.RS
|
||||
.TP 3
|
||||
.B -
|
||||
.bP
|
||||
if neither \fBdialog_vars.ascii_lines\fP nor \fBdialog_vars.no_lines\fP is set.
|
||||
.TP 3
|
||||
.B -
|
||||
.bP
|
||||
if \fBdialog_vars.ascii_lines\fP is set, returns the corresponding "+" or "-", etc. for the line-drawing characters used in \fB\*p\fP.
|
||||
.TP 3
|
||||
.B -
|
||||
.bP
|
||||
otherwise, if \fBdialog_vars.no_lines\fP is set, returns a space for the line-drawing characters.
|
||||
.TP 3
|
||||
.B -
|
||||
.bP
|
||||
if the parameter is not a line-drawing or other special character such as ACS_DARROW, it returns the parameter unchanged.
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
@ -1426,6 +1624,56 @@ is the height of the widget.
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_buildlist
|
||||
This is an alternate interface to the \fBbuildlist\fP widget
|
||||
which allows the application to read the list item states back
|
||||
directly without putting them in the output buffer.
|
||||
.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 \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.
|
||||
.TP 5
|
||||
.B int \fIitem_no
|
||||
is the number of rows in \fIitems\fP.
|
||||
.TP 5
|
||||
.B DIALOG_LISTITEM * \fIitems
|
||||
is the list of items, contain tag, name, and optionally help strings
|
||||
(if \fBdialog_vars.item_help\fP is set).
|
||||
The initial selection state for each item is also in this list.
|
||||
.TP 5
|
||||
.B const char * \fIstates
|
||||
This is a list of characters to display for the given states.
|
||||
Normally a buildlist provides true (1) and false (0) values,
|
||||
which the widget displays as "*" and space, respectively.
|
||||
An application may set this parameter to an arbitrary null-terminated string.
|
||||
The widget determines the number of states from the length of this string,
|
||||
and will cycle through the corresponding display characters as the user
|
||||
presses the space-bar.
|
||||
.TP 5
|
||||
.B int \fIorder_mode
|
||||
is reserved for future enhancements
|
||||
.TP 5
|
||||
.B int * \fIcurrent_item
|
||||
The widget sets the referenced location to the index of the current display
|
||||
item (cursor) when it returns.
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_button_count
|
||||
Count the buttons in the list.
|
||||
.RS
|
||||
@ -1498,6 +1746,16 @@ abbreviation.
|
||||
If the label is empty, return -1.
|
||||
If no uppercase character is found, return 0.
|
||||
Otherwise return the uppercase character.
|
||||
.IP
|
||||
Normally
|
||||
.B dlg_draw_buttons
|
||||
and
|
||||
.B dlg_char_to_button
|
||||
use the first uppercase character.
|
||||
However, they keep track of all of the labels and
|
||||
if the first has already been used in another label,
|
||||
they will continue looking for another uppercase character.
|
||||
This function does not have enough information to make that check.
|
||||
.RS
|
||||
.TP 5
|
||||
.B const char * \fIlabel
|
||||
@ -1506,8 +1764,8 @@ is the label to test.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_calc_list_width
|
||||
Calculate the minimum width for the list, assuming none of the items
|
||||
are truncated.
|
||||
Calculate the minimum width for the list,
|
||||
assuming none of the items are truncated.
|
||||
.RS
|
||||
.TP 5
|
||||
.B int \fIitem_no
|
||||
@ -1518,6 +1776,9 @@ contains a \fIname\fP and \fItext\fP field,
|
||||
e.g., for checklists or radiobox lists.
|
||||
The function returns the sum of the widest columns
|
||||
needed for of each of these fields.
|
||||
.IP
|
||||
If \fBdialog_vars.no_items\fP is set,
|
||||
the \fItext\fP fields in the list are ignored.
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
@ -2679,6 +2940,21 @@ is the top-row for the base
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_mouse_setcode
|
||||
Sets a value used internally by \fBdlg_mouse_mkregion\fP
|
||||
which is added to the \fIcode\fP parameter.
|
||||
By providing different values,
|
||||
e.g., multiples of \fBKEY_MAX\fP,
|
||||
it is possible to support multiple "big" regions in a widget.
|
||||
The \fIbuildlist\fP widget uses this feature to recognize mouse-clicks
|
||||
in the left/right panes.
|
||||
.RS
|
||||
.TP 5
|
||||
.B int \fIcode
|
||||
is the value to add to \fBdlg_mouse_mkregion\fP's \fIcode\fP parameter.
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_mouse_wgetch
|
||||
is a wrapper for \fBdlg_getc\fP which additionally maps mouse-clicks
|
||||
(if the curses library supports those) into extended function-keys
|
||||
@ -2834,6 +3110,35 @@ is the current button index
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_print_listitem
|
||||
This is a helper function used for the various "list" widgets,
|
||||
e.g., checklist, menu, buildlist, treeview.
|
||||
Each list-widget has "tag" and "description" values for each item
|
||||
which can be displayed.
|
||||
If \fBdialog_vars.no_tags\fP is true,
|
||||
the "tag" value is not shown.
|
||||
The first character of the first value shown (tag or description)
|
||||
is highlighted to indicate that the widget will match it for quick navigation.
|
||||
.RS
|
||||
.TP 5
|
||||
.B WINDOW *\fIwin
|
||||
the window in which to display the text
|
||||
.TP 5
|
||||
.B const char *\fItext
|
||||
the value to display
|
||||
.TP 5
|
||||
.B int \fIclimit
|
||||
the number of columns available for printing the text
|
||||
.TP 5
|
||||
.B bool \fIfirst
|
||||
true if this is the first call (for "tag" and "description"),
|
||||
and the first character of the value should be highlighted.
|
||||
.TP 5
|
||||
.B int \fIselected
|
||||
nonzero if the text should be displayed using the "selected" colors
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_print_scrolled
|
||||
This is a wrapper for \fBdlg_print_autowrap\fP which allows the user
|
||||
to scroll too-long prompt text up/down.
|
||||
@ -3070,7 +3375,7 @@ Restore \fB\*p\fP's variables from the given variable (see \fBdialog_save_vars\f
|
||||
is the variable from which to restore.
|
||||
.RE
|
||||
.IP
|
||||
The
|
||||
The
|
||||
\fIDIALOG_VARS.input_length\fP and
|
||||
\fIDIALOG_VARS.input_result\fP members are treated specially,
|
||||
since these are used by a widget to pass data to the caller.
|
||||
@ -3097,7 +3402,7 @@ store the result of the mapping in the referenced location.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_save_vars
|
||||
Save \fB\*p\fP's variables into the given variable (see \fBdialog_restore_vars\fP).
|
||||
Save \fB\*p\fP's variables into the given variable (see \fBdlg_restore_vars\fP).
|
||||
.RS
|
||||
.TP 5
|
||||
.B DIALOG_VARS * \fIsave
|
||||
@ -3119,7 +3424,7 @@ is the window on which to place focus (usually a subwindow of a widget)
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_set_result
|
||||
Setup a fixed-buffer for the result in \fBdialog_vars.input_result\fP
|
||||
Setup a fixed-buffer for the result in \fBdialog_vars.input_result\fP
|
||||
.RS
|
||||
.TP 5
|
||||
.B const char * \fIstring
|
||||
@ -3231,7 +3536,7 @@ name and stores the file pointer in \fBdialog_state.trace\fP.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_trace_chr
|
||||
If \fBdialog_state.trace\fP is set,
|
||||
If \fBdialog_state.trace\fP is set,
|
||||
translate the parameters into a printable representation,
|
||||
log it on a "chr" line.
|
||||
.RS
|
||||
@ -3268,10 +3573,66 @@ DLG_TRACE(("this is dialog version %s\\n", dialog_version()));
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_trace_win
|
||||
If \fBdialog_state.trace\fP is set,
|
||||
If \fBdialog_state.trace\fP is set,
|
||||
log a printable picture of the given window.
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_treeview
|
||||
This is an alternate interface to 'treeview' which allows the application
|
||||
to read the list item states back directly without putting them in the
|
||||
output buffer.
|
||||
.RS
|
||||
.TP 5
|
||||
.B const char * \fItitle
|
||||
is the title on 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 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.
|
||||
.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.
|
||||
.TP 5
|
||||
.B int \fIitem_no
|
||||
is the number of rows in \fIitems\fP.
|
||||
.TP 5
|
||||
.B DIALOG_LISTITEM * \fIitems
|
||||
is the list of items, contain tag, name, and optionally help strings
|
||||
(if \fBdialog_vars.item_help\fP is set).
|
||||
The initial selection state for each item is also in this list.
|
||||
.TP 5
|
||||
.B const char * \fIstates
|
||||
This is a list of characters to display for the given states.
|
||||
Normally a buildlist provides true (1) and false (0) values,
|
||||
which the widget displays as "*" and space, respectively.
|
||||
An application may set this parameter to an arbitrary null-terminated string.
|
||||
The widget determines the number of states from the length of this string,
|
||||
and will cycle through the corresponding display characters as the user
|
||||
presses the space-bar.
|
||||
.TP 5
|
||||
.B int * \fIdepths
|
||||
This is a list of depths of each item in the tree.
|
||||
It is a separate parameter from \fIitems\fP to allow reuse of
|
||||
the existing functions.
|
||||
.TP 5
|
||||
.B int \fIflag
|
||||
is either \fIFLAG_CHECK\fP, for checklists (multiple selections),
|
||||
or \fIFLAG_RADIO\fP for radiolists (a single selection).
|
||||
.TP 5
|
||||
.B int * \fIcurrent_item
|
||||
The widget sets the referenced location to the index of the current display
|
||||
item (cursor) when it returns.
|
||||
.RE
|
||||
.\" ---------------------------------------------------------------------------
|
||||
.TP 5
|
||||
.B dlg_trim_string
|
||||
The \fBdialog\fP program uses this in each widget to adjust the
|
||||
message string,
|
||||
|
200
dialog.c
200
dialog.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: dialog.c,v 1.202 2012/07/01 20:20:39 tom Exp $
|
||||
* $Id: dialog.c,v 1.230 2013/03/15 09:07:30 tom Exp $
|
||||
*
|
||||
* cdialog - Display simple dialog boxes from shell scripts
|
||||
*
|
||||
* Copyright 2000-2011,2012 Thomas E. Dickey
|
||||
* Copyright 2000-2012,2013 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
|
||||
@ -48,7 +48,6 @@ typedef enum {
|
||||
,o_beep
|
||||
,o_beep_after
|
||||
,o_begin
|
||||
,o_calendar
|
||||
,o_cancel_label
|
||||
,o_checklist
|
||||
,o_clear
|
||||
@ -60,15 +59,11 @@ typedef enum {
|
||||
,o_default_button
|
||||
,o_default_item
|
||||
,o_defaultno
|
||||
,o_dselect
|
||||
,o_editbox
|
||||
,o_exit_label
|
||||
,o_extra_button
|
||||
,o_extra_label
|
||||
,o_fixed_font
|
||||
,o_form
|
||||
,o_fselect
|
||||
,o_fullbutton
|
||||
,o_gauge
|
||||
,o_help
|
||||
,o_help_button
|
||||
@ -87,6 +82,7 @@ typedef enum {
|
||||
,o_keep_colors
|
||||
,o_keep_tite
|
||||
,o_keep_window
|
||||
,o_last_key
|
||||
,o_max_input
|
||||
,o_menu
|
||||
,o_mixedform
|
||||
@ -102,7 +98,6 @@ typedef enum {
|
||||
,o_no_nl_expand
|
||||
,o_no_shadow
|
||||
,o_nocancel
|
||||
,o_noitem
|
||||
,o_nook
|
||||
,o_ok_label
|
||||
,o_output_fd
|
||||
@ -136,7 +131,6 @@ typedef enum {
|
||||
,o_tailboxbg
|
||||
,o_textbox
|
||||
,o_time_format
|
||||
,o_timebox
|
||||
,o_timeout
|
||||
,o_title
|
||||
,o_trim
|
||||
@ -146,6 +140,26 @@ typedef enum {
|
||||
,o_wmclass
|
||||
,o_yes_label
|
||||
,o_yesno
|
||||
#ifdef HAVE_WHIPTAIL
|
||||
,o_fullbutton
|
||||
,o_topleft
|
||||
#endif
|
||||
#ifdef HAVE_XDIALOG
|
||||
,o_calendar
|
||||
,o_dselect
|
||||
,o_editbox
|
||||
,o_fselect
|
||||
,o_timebox
|
||||
#endif
|
||||
#ifdef HAVE_XDIALOG2
|
||||
,o_buildlist
|
||||
,o_rangebox
|
||||
,o_treeview
|
||||
#endif
|
||||
#if defined(HAVE_XDIALOG2) || defined(HAVE_WHIPTAIL)
|
||||
,o_no_items
|
||||
,o_no_tags
|
||||
#endif
|
||||
#ifdef HAVE_DLG_TRACE
|
||||
,o_trace
|
||||
#endif
|
||||
@ -190,10 +204,9 @@ static const Options options[] = {
|
||||
{ "aspect", o_aspect, 1, "<ratio>" },
|
||||
{ "auto-placement", o_auto_placement, 1, NULL },
|
||||
{ "backtitle", o_backtitle, 1, "<backtitle>" },
|
||||
{ "beep", o_beep, 1, NULL },
|
||||
{ "beep-after", o_beep_after, 1, NULL },
|
||||
{ "beep", o_beep, 1, "" },
|
||||
{ "beep-after", o_beep_after, 1, "" },
|
||||
{ "begin", o_begin, 1, "<y> <x>" },
|
||||
{ "calendar", o_calendar, 2, "<text> <height> <width> <day> <month> <year>" },
|
||||
{ "cancel-label", o_cancel_label, 1, "<str>" },
|
||||
{ "checklist", o_checklist, 2, "<text> <height> <width> <list height> <tag1> <item1> <status1>..." },
|
||||
{ "clear", o_clear, 1, "" },
|
||||
@ -205,16 +218,11 @@ static const Options options[] = {
|
||||
{ "default-button", o_default_button, 1, "<str>" },
|
||||
{ "default-item", o_default_item, 1, "<str>" },
|
||||
{ "defaultno", o_defaultno, 1, "" },
|
||||
{ "dselect", o_dselect, 2, "<directory> <height> <width>" },
|
||||
{ "editbox", o_editbox, 2, "<file> <height> <width>" },
|
||||
{ "exit-label", o_exit_label, 1, "<str>" },
|
||||
{ "extra-button", o_extra_button, 1, "" },
|
||||
{ "extra-label", o_extra_label, 1, "<str>" },
|
||||
{ "fb", o_fullbutton, 1, NULL },
|
||||
{ "fixed-font", o_fixed_font, 1, NULL },
|
||||
{ "form", o_form, 2, "<text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>..." },
|
||||
{ "fselect", o_fselect, 2, "<filepath> <height> <width>" },
|
||||
{ "fullbutton", o_fullbutton, 1, NULL },
|
||||
{ "gauge", o_gauge, 2, "<text> <height> <width> [<percent>]" },
|
||||
{ "guage", o_gauge, 2, NULL },
|
||||
{ "help", o_help, 4, "" },
|
||||
@ -234,6 +242,7 @@ static const Options options[] = {
|
||||
{ "keep-colors", o_keep_colors, 1, NULL },
|
||||
{ "keep-tite", o_keep_tite, 1, "" },
|
||||
{ "keep-window", o_keep_window, 1, "" },
|
||||
{ "last-key", o_last_key, 1, "" },
|
||||
{ "max-input", o_max_input, 1, "<n>" },
|
||||
{ "menu", o_menu, 2, "<text> <height> <width> <menu height> <tag1> <item1>..." },
|
||||
{ "mixedform", o_mixedform, 2, "<text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1> <itype>..." },
|
||||
@ -242,7 +251,7 @@ static const Options options[] = {
|
||||
{ "no-cancel", o_nocancel, 1, "" },
|
||||
{ "no-close", o_no_close, 1, NULL },
|
||||
{ "no-collapse", o_no_collapse, 1, "" },
|
||||
{ "no-cr-wrap", o_no_cr_wrap, 1, NULL },
|
||||
{ "no-cr-wrap", o_no_cr_wrap, 1, "" },
|
||||
{ "no-kill", o_no_kill, 1, "" },
|
||||
{ "no-label", o_no_label, 1, "<str>" },
|
||||
{ "no-lines", o_no_lines, 1, "" },
|
||||
@ -251,7 +260,6 @@ static const Options options[] = {
|
||||
{ "no-ok", o_nook, 1, "" },
|
||||
{ "no-shadow", o_no_shadow, 1, "" },
|
||||
{ "nocancel", o_nocancel, 1, NULL }, /* see --no-cancel */
|
||||
{ "noitem", o_noitem, 1, NULL },
|
||||
{ "nook", o_nook, 1, "" }, /* See no-ok */
|
||||
{ "ok-label", o_ok_label, 1, "<str>" },
|
||||
{ "output-fd", o_output_fd, 1, "<fd>" },
|
||||
@ -285,7 +293,6 @@ static const Options options[] = {
|
||||
{ "tailboxbg", o_tailboxbg, 2, "<file> <height> <width>" },
|
||||
{ "textbox", o_textbox, 2, "<file> <height> <width>" },
|
||||
{ "time-format", o_time_format, 1, "<str>" },
|
||||
{ "timebox", o_timebox, 2, "<text> <height> <width> <hour> <minute> <second>" },
|
||||
{ "timeout", o_timeout, 1, "<secs>" },
|
||||
{ "title", o_title, 1, "<title>" },
|
||||
{ "trim", o_trim, 1, "" },
|
||||
@ -295,6 +302,34 @@ static const Options options[] = {
|
||||
{ "wmclass", o_wmclass, 1, NULL },
|
||||
{ "yes-label", o_yes_label, 1, "<str>" },
|
||||
{ "yesno", o_yesno, 2, "<text> <height> <width>" },
|
||||
#ifdef HAVE_WHIPTAIL
|
||||
{ "cancel-button", o_cancel_label, 1, NULL },
|
||||
{ "fb", o_fullbutton, 1, NULL },
|
||||
{ "fullbutton", o_fullbutton, 1, NULL },
|
||||
{ "no-button", o_no_label, 1, NULL },
|
||||
{ "ok-button", o_ok_label, 1, NULL },
|
||||
{ "scrolltext", o_scrollbar, 1, NULL },
|
||||
{ "topleft", o_topleft, 1, NULL },
|
||||
{ "yes-button", o_yes_label, 1, NULL },
|
||||
#endif
|
||||
#ifdef HAVE_XDIALOG
|
||||
{ "calendar", o_calendar, 2, "<text> <height> <width> <day> <month> <year>" },
|
||||
{ "dselect", o_dselect, 2, "<directory> <height> <width>" },
|
||||
{ "editbox", o_editbox, 2, "<file> <height> <width>" },
|
||||
{ "fselect", o_fselect, 2, "<filepath> <height> <width>" },
|
||||
{ "timebox", o_timebox, 2, "<text> <height> <width> <hour> <minute> <second>" },
|
||||
#endif
|
||||
#ifdef HAVE_XDIALOG2
|
||||
{ "buildlist", o_buildlist, 2, "<text> <height> <width> <tag1> <item1> <status1>..." },
|
||||
{ "no-items", o_no_items, 1, "" },
|
||||
{ "no-tags", o_no_tags, 1, "" },
|
||||
{ "rangebox", o_rangebox, 2, "<text> <height> <width> <min-value> <max-value> <default-value>" },
|
||||
{ "treeview", o_treeview, 2, "<text> <height> <width> <list-height> <tag1> <item1> <status1> <depth1>..." },
|
||||
#endif
|
||||
#if defined(HAVE_XDIALOG2) || defined(HAVE_WHIPTAIL)
|
||||
{ "noitem", o_no_items, 1, NULL },
|
||||
{ "notags", o_no_tags, 1, NULL },
|
||||
#endif
|
||||
#ifdef HAVE_DLG_TRACE
|
||||
{ "trace", o_trace, 1, "<file>" },
|
||||
#endif
|
||||
@ -537,13 +572,17 @@ howmany_tags(char *argv[], int group)
|
||||
static int
|
||||
numeric_arg(char **av, int n)
|
||||
{
|
||||
char *last = 0;
|
||||
int result = (int) strtol(av[n], &last, 10);
|
||||
char msg[80];
|
||||
int result = 0;
|
||||
|
||||
if (last == 0 || *last != 0) {
|
||||
sprintf(msg, "Expected a number for token %d of %.20s", n, av[0]);
|
||||
Usage(msg);
|
||||
if (n < dlg_count_argv(av)) {
|
||||
char msg[80];
|
||||
char *last = 0;
|
||||
result = (int) strtol(av[n], &last, 10);
|
||||
|
||||
if (last == 0 || *last != 0) {
|
||||
sprintf(msg, "Expected a number for token %d of %.20s", n, av[0]);
|
||||
Usage(msg);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -803,6 +842,75 @@ call_timebox(CALLARGS)
|
||||
}
|
||||
#endif /* HAVE_XDIALOG */
|
||||
|
||||
/* dialog 1.2 widgets */
|
||||
#ifdef HAVE_XDIALOG2
|
||||
|
||||
#define DisableNoTags() \
|
||||
bool save_no_tags = dialog_vars.no_tags; \
|
||||
bool save_no_items = dialog_vars.no_items; \
|
||||
dialog_vars.no_tags = TRUE; \
|
||||
dialog_vars.no_items = FALSE
|
||||
|
||||
#define RestoreNoTags() \
|
||||
dialog_vars.no_tags = save_no_tags; \
|
||||
dialog_vars.no_items = save_no_items
|
||||
|
||||
static int
|
||||
call_buildlist(CALLARGS)
|
||||
{
|
||||
int tags = howmany_tags(av + 5, CHECKBOX_TAGS);
|
||||
int result;
|
||||
|
||||
DisableNoTags();
|
||||
|
||||
*offset_add = 5 + tags * CHECKBOX_TAGS;
|
||||
result = dialog_buildlist(t,
|
||||
av[1],
|
||||
numeric_arg(av, 2),
|
||||
numeric_arg(av, 3),
|
||||
numeric_arg(av, 4),
|
||||
tags, av + 5,
|
||||
TRUE);
|
||||
RestoreNoTags();
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
call_rangebox(CALLARGS)
|
||||
{
|
||||
int min_value;
|
||||
|
||||
*offset_add = arg_rest(av);
|
||||
min_value = numeric_arg(av, 4);
|
||||
return dialog_rangebox(t,
|
||||
av[1],
|
||||
numeric_arg(av, 2),
|
||||
numeric_arg(av, 3),
|
||||
min_value,
|
||||
numeric_arg(av, 5),
|
||||
(*offset_add > 6) ? numeric_arg(av, 6) : min_value);
|
||||
}
|
||||
|
||||
static int
|
||||
call_treeview(CALLARGS)
|
||||
{
|
||||
int tags = howmany_tags(av + 5, TREEVIEW_TAGS);
|
||||
int result;
|
||||
|
||||
DisableNoTags();
|
||||
|
||||
*offset_add = arg_rest(av);
|
||||
result = dialog_treeview(t,
|
||||
av[1],
|
||||
numeric_arg(av, 2),
|
||||
numeric_arg(av, 3),
|
||||
numeric_arg(av, 4),
|
||||
tags, av + 5, FLAG_RADIO);
|
||||
RestoreNoTags();
|
||||
return result;
|
||||
}
|
||||
#endif /* HAVE_XDIALOG */
|
||||
|
||||
#ifdef HAVE_DLG_FORMBOX
|
||||
static int
|
||||
call_form(CALLARGS)
|
||||
@ -1017,11 +1125,14 @@ static const Mode modes[] =
|
||||
{o_tailboxbg, 4, 4, call_tailboxbg},
|
||||
#endif
|
||||
#ifdef HAVE_XDIALOG
|
||||
{o_buildlist, 4, 0, call_buildlist},
|
||||
{o_calendar, 4, 7, call_calendar},
|
||||
{o_dselect, 4, 5, call_dselect},
|
||||
{o_editbox, 4, 4, call_editbox},
|
||||
{o_fselect, 4, 5, call_fselect},
|
||||
{o_rangebox, 5, 7, call_rangebox},
|
||||
{o_timebox, 4, 7, call_timebox},
|
||||
{o_treeview, 4, 0, call_treeview},
|
||||
#endif
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
@ -1163,7 +1274,7 @@ Help(void)
|
||||
static const char *const tbl_1[] =
|
||||
{
|
||||
"cdialog (ComeOn Dialog!) version %s",
|
||||
"Copyright 2000-2011,2012 Thomas E. Dickey",
|
||||
"Copyright 2000-2012,2013 Thomas E. Dickey",
|
||||
"This is free software; see the source for copying conditions. There is NO",
|
||||
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",
|
||||
"",
|
||||
@ -1239,14 +1350,17 @@ process_trace_option(char **argv, int *offset)
|
||||
{
|
||||
int j;
|
||||
|
||||
if (dialog_state.trace_output == 0)
|
||||
if (dialog_state.trace_output == 0) {
|
||||
dlg_trace(optionString(argv, offset));
|
||||
} else {
|
||||
dlg_trace_msg("# ignore extra --trace option\n");
|
||||
*offset += 1;
|
||||
}
|
||||
|
||||
dlg_trace_msg("# Parameters:\n");
|
||||
for (j = 0; argv[j] != 0; ++j) {
|
||||
dlg_trace_msg("# argv[%d] = %s\n", j, argv[j]);
|
||||
}
|
||||
*offset += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1357,6 +1471,9 @@ process_common_options(int argc, char **argv, int offset, bool output)
|
||||
case o_keep_window:
|
||||
dialog_vars.keep_window = TRUE;
|
||||
break;
|
||||
case o_last_key:
|
||||
dialog_vars.last_key = TRUE;
|
||||
break;
|
||||
case o_no_shadow:
|
||||
dialog_state.use_shadow = FALSE;
|
||||
break;
|
||||
@ -1410,6 +1527,7 @@ process_common_options(int argc, char **argv, int offset, bool output)
|
||||
break;
|
||||
case o_visit_items:
|
||||
dialog_state.visit_items = TRUE;
|
||||
dialog_state.visit_cols = 1;
|
||||
break;
|
||||
case o_aspect:
|
||||
dialog_state.aspect_ratio = optionValue(argv, &offset);
|
||||
@ -1464,10 +1582,16 @@ process_common_options(int argc, char **argv, int offset, bool output)
|
||||
dialog_state.no_mouse = TRUE;
|
||||
mouse_close();
|
||||
break;
|
||||
case o_noitem:
|
||||
#ifdef HAVE_WHIPTAIL
|
||||
case o_topleft:
|
||||
dialog_vars.begin_set = TRUE;
|
||||
dialog_vars.begin_y = 0;
|
||||
dialog_vars.begin_x = 0;
|
||||
break;
|
||||
case o_fullbutton:
|
||||
/* ignore */
|
||||
break;
|
||||
#endif
|
||||
/* options of Xdialog which we ignore */
|
||||
case o_icon:
|
||||
case o_wmclass:
|
||||
@ -1494,6 +1618,14 @@ process_common_options(int argc, char **argv, int offset, bool output)
|
||||
case o_trace:
|
||||
process_trace_option(argv, &offset);
|
||||
break;
|
||||
#endif
|
||||
#if defined(HAVE_XDIALOG2) || defined(HAVE_WHIPTAIL)
|
||||
case o_no_items:
|
||||
dialog_vars.no_items = TRUE;
|
||||
break;
|
||||
case o_no_tags:
|
||||
dialog_vars.no_tags = TRUE;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
if (!done)
|
||||
@ -1773,7 +1905,13 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
default:
|
||||
if (argv[j] != 0) {
|
||||
dlg_trim_string(argv[j]);
|
||||
char *argv_j = strdup(argv[j]);
|
||||
if (argv_j != 0) {
|
||||
dlg_trim_string(argv_j);
|
||||
argv[j] = argv_j;
|
||||
} else {
|
||||
argv[j] = strdup("?");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
54
dialog.h
54
dialog.h
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: dialog.h,v 1.245 2012/07/01 18:44:03 tom Exp $
|
||||
* $Id: dialog.h,v 1.260 2013/03/17 15:03:41 tom Exp $
|
||||
*
|
||||
* dialog.h -- common declarations for all dialog modules
|
||||
*
|
||||
* Copyright 2000-2011,2012 Thomas E. Dickey
|
||||
* Copyright 2000-2012,2013 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
|
||||
@ -240,6 +240,16 @@
|
||||
#define wgetparent(win) ((win) ? (win)->_parent : 0)
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_WSYNCUP)
|
||||
#undef wsyncup
|
||||
#define wsyncup(win) /* nothing */
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_WCURSYNCUP)
|
||||
#undef wcursyncup
|
||||
#define wcursyncup(win) /* nothing */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -320,6 +330,7 @@ extern WINDOW * dlg_wgetparent(WINDOW * /*win*/);
|
||||
#define mouse_mkregion(y,x,h,w,n) dlg_mouse_mkregion(y,x,h,w,n)
|
||||
#define mouse_region(y,x) dlg_mouse_region(y,x)
|
||||
#define mouse_setbase(x,y) dlg_mouse_setbase(x,y)
|
||||
#define mouse_setcode(c) dlg_mouse_setcode(c)
|
||||
#define mouse_wgetch(w,c) dlg_mouse_wgetch(w,c)
|
||||
#define new_window(h,w,y,x) dlg_new_window(h,w,y,x)
|
||||
#define parse_rc() dlg_parse_rc()
|
||||
@ -433,6 +444,7 @@ typedef struct {
|
||||
#endif
|
||||
/* 1.1-20110106 */
|
||||
bool no_mouse; /* option "--no-mouse" */
|
||||
int visit_cols; /* option "--visit-items" */
|
||||
} DIALOG_STATE;
|
||||
|
||||
extern DIALOG_STATE dialog_state;
|
||||
@ -505,14 +517,31 @@ typedef struct {
|
||||
bool no_nl_expand; /* option "--no-nl-expand" */
|
||||
/* 1.1-20120701 */
|
||||
int default_button; /* option "--default-button" (exit code) */
|
||||
/* 1.1-20121218 */
|
||||
bool no_tags; /* option "--no-tags" */
|
||||
bool no_items; /* option "--no-items" */
|
||||
/* 1.2-20130315 */
|
||||
bool last_key; /* option "--last-key" */
|
||||
} DIALOG_VARS;
|
||||
|
||||
#define USE_ITEM_HELP(s) (dialog_vars.item_help && (s) != 0)
|
||||
#define CHECKBOX_TAGS (dialog_vars.item_help ? 4 : 3)
|
||||
#define MENUBOX_TAGS (dialog_vars.item_help ? 3 : 2)
|
||||
#define FORMBOX_TAGS (dialog_vars.item_help ? 9 : 8)
|
||||
#define MIXEDFORM_TAGS (FORMBOX_TAGS + 1)
|
||||
|
||||
/*
|
||||
* Some settings change the number of data items per row which dialog reads
|
||||
* from a script.
|
||||
*/
|
||||
#define DLG__NO_ITEMS (dialog_vars.no_items ? 0 : 1)
|
||||
#define DLG__ITEM_HELP (dialog_vars.item_help ? 1 : 0)
|
||||
|
||||
/*
|
||||
* These are the total number of data items per row used for each widget type.
|
||||
*/
|
||||
#define CHECKBOX_TAGS (2 + DLG__ITEM_HELP + DLG__NO_ITEMS)
|
||||
#define MENUBOX_TAGS (1 + DLG__ITEM_HELP + DLG__NO_ITEMS)
|
||||
#define FORMBOX_TAGS (8 + DLG__ITEM_HELP)
|
||||
#define MIXEDFORM_TAGS (1 + FORMBOX_TAGS)
|
||||
#define MIXEDGAUGE_TAGS 2
|
||||
#define TREEVIEW_TAGS (3 + DLG__ITEM_HELP + DLG__NO_ITEMS)
|
||||
|
||||
extern DIALOG_VARS dialog_vars;
|
||||
|
||||
@ -552,6 +581,7 @@ extern DIALOG_COLORS dlg_color_table[];
|
||||
extern const char *dialog_version(void);
|
||||
|
||||
/* widgets, each in separate files */
|
||||
extern int dialog_buildlist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*order_mode*/);
|
||||
extern int dialog_calendar(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*day*/, int /*month*/, int /*year*/);
|
||||
extern int dialog_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/);
|
||||
extern int dialog_dselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/);
|
||||
@ -568,9 +598,11 @@ extern int dialog_msgbox(const char * /*title*/, const char * /*cprompt*/, int /
|
||||
extern int dialog_pause(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*seconds*/);
|
||||
extern int dialog_prgbox(const char * /*title*/, const char * /*cprompt*/, const char * /*command*/, int /*height*/, int /*width*/, int /*pauseopt*/);
|
||||
extern int dialog_progressbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/);
|
||||
extern int dialog_rangebox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*min_value*/, int /*max_value*/, int /*default_value*/);
|
||||
extern int dialog_tailbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*bg_task*/);
|
||||
extern int dialog_textbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);
|
||||
extern int dialog_timebox(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*hour*/, int /*minute*/, int /*second*/);
|
||||
extern int dialog_treeview(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/);
|
||||
extern int dialog_yesno(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/);
|
||||
|
||||
/* some widgets have alternate entrypoints, to allow list manipulation */
|
||||
@ -617,6 +649,9 @@ extern void dlg_draw_arrows2(WINDOW * /*dialog*/, int /*top_arrow*/, int /*botto
|
||||
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*/);
|
||||
|
||||
/* buildlist.c */
|
||||
extern int dlg_buildlist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int /*order_mode*/, int * /*current_item*/);
|
||||
|
||||
/* buttons.c */
|
||||
extern const char ** dlg_exit_label(void);
|
||||
extern const char ** dlg_ok_label(void);
|
||||
@ -676,10 +711,14 @@ extern int dlg_parse_rc(void);
|
||||
extern void dlg_create_rc(const char * /*filename*/);
|
||||
#endif
|
||||
|
||||
/* treeview.c */
|
||||
extern int dlg_treeview(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int * /*depths*/, int /*flag*/, int * /*current_item*/);
|
||||
|
||||
/* ui_getc.c */
|
||||
extern int dlg_getc(WINDOW * /*win*/, int * /*fkey*/);
|
||||
extern int dlg_getc_callbacks(int /*ch*/, int /*fkey*/, int * /*result*/);
|
||||
extern int dlg_last_getc(void);
|
||||
extern void dlg_add_last_key(int /*mode*/);
|
||||
extern void dlg_add_callback(DIALOG_CALLBACK * /*p*/);
|
||||
extern void dlg_add_callback_ref(DIALOG_CALLBACK ** /*p*/, DIALOG_FREEBACK /* cleanup */);
|
||||
extern void dlg_flush_getc(void);
|
||||
@ -732,6 +771,7 @@ extern void dlg_draw_title(WINDOW *win, const char *title);
|
||||
extern void dlg_exit(int /*code*/) GCC_NORETURN;
|
||||
extern void dlg_item_help(const char * /*txt*/);
|
||||
extern void dlg_print_autowrap(WINDOW * /*win*/, const char * /*prompt*/, int /*height*/, int /*width*/);
|
||||
extern void dlg_print_listitem(WINDOW * /*win*/, const char * /*text*/, int /*climit*/, bool /*first*/, int /*selected*/);
|
||||
extern void dlg_print_size(int /*height*/, int /*width*/);
|
||||
extern void dlg_print_text(WINDOW * /*win*/, const char * /*txt*/, int /*len*/, chtype * /*attr*/);
|
||||
extern void dlg_put_backtitle(void);
|
||||
@ -799,6 +839,7 @@ extern mseRegion * dlg_mouse_mkregion (int /*y*/, int /*x*/, int /*height*/, int
|
||||
extern void dlg_mouse_free_regions (void);
|
||||
extern void dlg_mouse_mkbigregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/, int /*step_x*/, int /*step_y*/, int /*mode*/);
|
||||
extern void dlg_mouse_setbase (int /*x*/, int /*y*/);
|
||||
extern void dlg_mouse_setcode (int /*code*/);
|
||||
|
||||
#define USE_MOUSE 1
|
||||
|
||||
@ -810,6 +851,7 @@ extern void dlg_mouse_setbase (int /*x*/, int /*y*/);
|
||||
#define dlg_mouse_mkregion(y, x, height, width, code) /*nothing*/
|
||||
#define dlg_mouse_mkbigregion(y, x, height, width, code, step_x, step_y, mode) /*nothing*/
|
||||
#define dlg_mouse_setbase(x, y) /*nothing*/
|
||||
#define dlg_mouse_setcode(c) /*nothing*/
|
||||
|
||||
#define USE_MOUSE 0
|
||||
|
||||
|
19
dlg_keys.h
19
dlg_keys.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: dlg_keys.h,v 1.31 2012/07/02 23:57:52 tom Exp $
|
||||
* $Id: dlg_keys.h,v 1.32 2012/12/21 21:54:30 tom Exp $
|
||||
*
|
||||
* dlg_keys.h -- runtime binding support for dialog
|
||||
*
|
||||
@ -124,23 +124,26 @@ typedef enum {
|
||||
DLG_KEYS_DATA( DLGK_GRID_LEFT, KEY_LEFT ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_RIGHT )
|
||||
|
||||
#define SCROLL_FKEY_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_DOWN ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, KEY_UP ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_FIRST, KEY_HOME ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_END ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE )
|
||||
|
||||
#define SCROLLKEY_BINDINGS \
|
||||
SCROLL_FKEY_BINDINGS, \
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, 'J' ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, 'j' ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_DOWN ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, 'K' ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, 'k' ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, KEY_UP ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_FIRST, 'g' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_FIRST, KEY_HOME ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, 'G' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_END ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'F' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'f' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, 'B' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, 'b' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE )
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, 'b' )
|
||||
|
||||
#define TRAVERSE_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_ENTER, ' ' ), \
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: editbox.c,v 1.61 2012/07/01 18:13:32 Zoltan.Kelemen Exp $
|
||||
* $Id: editbox.c,v 1.62 2013/03/17 15:03:41 tom Exp $
|
||||
*
|
||||
* editbox.c -- implements the edit box
|
||||
*
|
||||
* Copyright 2007-2011,2012 Thomas E. Dickey
|
||||
* Copyright 2007-2012,2013 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
|
||||
@ -710,6 +710,7 @@ dlg_editbox(const char *title,
|
||||
dlg_add_result((*list)[n]);
|
||||
dlg_add_separator();
|
||||
}
|
||||
dlg_add_last_key(-1);
|
||||
}
|
||||
free(buffer);
|
||||
dlg_restore_vars(&save_vars);
|
||||
|
62
formbox.c
62
formbox.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: formbox.c,v 1.81 2012/07/01 18:13:51 Zoltan.Kelemen Exp $
|
||||
* $Id: formbox.c,v 1.85 2013/03/17 15:03:41 tom Exp $
|
||||
*
|
||||
* formbox.c -- implements the form (i.e, some pairs label/editbox)
|
||||
*
|
||||
* Copyright 2003-2011,2012 Thomas E. Dickey
|
||||
* Copyright 2003-2012,2013 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
|
||||
@ -287,6 +287,7 @@ tab_next(WINDOW *win,
|
||||
static bool
|
||||
scroll_next(WINDOW *win, DIALOG_FORMITEM item[], int stepsize, int *choice, int *scrollamt)
|
||||
{
|
||||
bool result = TRUE;
|
||||
int old_choice = *choice;
|
||||
int old_scroll = *scrollamt;
|
||||
int old_row = MIN(item[old_choice].text_y, item[old_choice].name_y);
|
||||
@ -298,34 +299,40 @@ scroll_next(WINDOW *win, DIALOG_FORMITEM item[], int stepsize, int *choice, int
|
||||
target = old_scroll;
|
||||
else
|
||||
target = old_scroll + stepsize;
|
||||
if (target < 0)
|
||||
target = 0;
|
||||
if (target < 0) {
|
||||
result = FALSE;
|
||||
}
|
||||
} else {
|
||||
int limit = form_limit(item);
|
||||
if (target > limit)
|
||||
target = limit;
|
||||
}
|
||||
|
||||
for (n = 0; item[n].name != 0; ++n) {
|
||||
if (item[n].text_flen > 0) {
|
||||
int new_row = MIN(item[n].text_y, item[n].name_y);
|
||||
if (abs(new_row - target) < abs(old_row - target)) {
|
||||
old_row = new_row;
|
||||
*choice = n;
|
||||
}
|
||||
if (target > form_limit(item)) {
|
||||
result = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (old_choice != *choice)
|
||||
print_item(win, item + old_choice, *scrollamt, FALSE);
|
||||
if (result) {
|
||||
for (n = 0; item[n].name != 0; ++n) {
|
||||
if (item[n].text_flen > 0) {
|
||||
int new_row = MIN(item[n].text_y, item[n].name_y);
|
||||
if (abs(new_row - target) < abs(old_row - target)) {
|
||||
old_row = new_row;
|
||||
*choice = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*scrollamt = *choice;
|
||||
if (*scrollamt != old_scroll) {
|
||||
scrollok(win, TRUE);
|
||||
wscrl(win, *scrollamt - old_scroll);
|
||||
scrollok(win, FALSE);
|
||||
if (old_choice != *choice)
|
||||
print_item(win, item + old_choice, *scrollamt, FALSE);
|
||||
|
||||
*scrollamt = *choice;
|
||||
if (*scrollamt != old_scroll) {
|
||||
scrollok(win, TRUE);
|
||||
wscrl(win, *scrollamt - old_scroll);
|
||||
scrollok(win, FALSE);
|
||||
}
|
||||
result = (old_choice != *choice) || (old_scroll != *scrollamt);
|
||||
}
|
||||
return (old_choice != *choice) || (old_scroll != *scrollamt);
|
||||
if (!result)
|
||||
beep();
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -447,7 +454,7 @@ prev_valid_buttonindex(int state, int extra, bool non_editable)
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE )
|
||||
/*
|
||||
* Display a form for fulfill a number of fields
|
||||
* Display a form for entering a number of fields
|
||||
*/
|
||||
int
|
||||
dlg_form(const char *title,
|
||||
@ -484,7 +491,7 @@ dlg_form(const char *title,
|
||||
int first = TRUE;
|
||||
int first_trace = TRUE;
|
||||
int chr_offset = 0;
|
||||
int state = dialog_vars.default_button >=0 ? dlg_default_button() : sTEXT;
|
||||
int state = dialog_vars.default_button >= 0 ? dlg_default_button() : sTEXT;
|
||||
int x, y, cur_x, cur_y, box_x, box_y;
|
||||
int code;
|
||||
int key = 0;
|
||||
@ -626,6 +633,8 @@ dlg_form(const char *title,
|
||||
current->text_x,
|
||||
current->text_len,
|
||||
is_hidden(current), first);
|
||||
wsyncup(form);
|
||||
wcursyncup(form);
|
||||
field_changed = FALSE;
|
||||
}
|
||||
|
||||
@ -964,6 +973,7 @@ dialog_form(const char *title,
|
||||
dlg_add_separator();
|
||||
}
|
||||
}
|
||||
dlg_add_last_key(-1);
|
||||
}
|
||||
|
||||
dlg_free_formitems(listitems);
|
||||
|
68
fselect.c
68
fselect.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fselect.c,v 1.87 2012/07/01 18:14:09 Zoltan.Kelemen Exp $
|
||||
* $Id: fselect.c,v 1.93 2012/12/30 20:52:25 tom Exp $
|
||||
*
|
||||
* fselect.c -- implements the file-selector box
|
||||
*
|
||||
@ -367,7 +367,7 @@ match(char *name, LIST * d_list, LIST * f_list, MATCH * match_list)
|
||||
matches[data_len++] = f_list->data[i];
|
||||
}
|
||||
}
|
||||
matches = dlg_realloc(char *, data_len, matches);
|
||||
matches = dlg_realloc(char *, data_len + 1, matches);
|
||||
match_list->data = matches;
|
||||
match_list->length = (int) data_len;
|
||||
}
|
||||
@ -457,13 +457,18 @@ fill_lists(char *current, char *input, LIST * d_list, LIST * f_list, int keep)
|
||||
}
|
||||
|
||||
if (rescan) {
|
||||
size_t have = strlen(input);
|
||||
|
||||
strcpy(current, input);
|
||||
if (have > MAX_LEN)
|
||||
have = MAX_LEN;
|
||||
memcpy(current, input, have);
|
||||
current[have] = '\0';
|
||||
|
||||
/* refill the lists */
|
||||
free_list(d_list, TRUE);
|
||||
free_list(f_list, TRUE);
|
||||
strcpy(path, current);
|
||||
memcpy(path, current, have);
|
||||
path[have] = '\0';
|
||||
if ((leaf = strrchr(path, '/')) != 0) {
|
||||
*++leaf = 0;
|
||||
} else {
|
||||
@ -483,14 +488,18 @@ fill_lists(char *current, char *input, LIST * d_list, LIST * f_list, int keep)
|
||||
}
|
||||
(void) closedir(dp);
|
||||
/* sort the lists */
|
||||
qsort(d_list->data,
|
||||
(size_t) d_list->length,
|
||||
sizeof(d_list->data[0]),
|
||||
compar);
|
||||
qsort(f_list->data,
|
||||
(size_t) f_list->length,
|
||||
sizeof(f_list->data[0]),
|
||||
compar);
|
||||
if (d_list->data != 0 && d_list->length > 1) {
|
||||
qsort(d_list->data,
|
||||
(size_t) d_list->length,
|
||||
sizeof(d_list->data[0]),
|
||||
compar);
|
||||
}
|
||||
if (f_list->data != 0 && f_list->length > 1) {
|
||||
qsort(f_list->data,
|
||||
(size_t) f_list->length,
|
||||
sizeof(f_list->data[0]),
|
||||
compar);
|
||||
}
|
||||
}
|
||||
|
||||
(void) show_both_lists(input, d_list, f_list, FALSE);
|
||||
@ -573,7 +582,7 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
|
||||
int fkey = FALSE;
|
||||
int code;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int state = dialog_vars.default_button >=0 ? dlg_default_button() : sTEXT;
|
||||
int state = dialog_vars.default_button >= 0 ? dlg_default_button() : sTEXT;
|
||||
int button;
|
||||
int first = (state == sTEXT);
|
||||
int first_trace = TRUE;
|
||||
@ -586,7 +595,7 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
|
||||
const char **buttons = dlg_ok_labels();
|
||||
const char *d_label = _("Directories");
|
||||
const char *f_label = _("Files");
|
||||
char *partial;
|
||||
char *partial = 0;
|
||||
int min_wide = MIN_WIDE;
|
||||
int min_items = height ? 0 : 4;
|
||||
LIST d_list, f_list;
|
||||
@ -631,8 +640,10 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
|
||||
tbox_x = (width - tbox_width) / 2;
|
||||
|
||||
w_text = derwin(dialog, tbox_height, tbox_width, tbox_y, tbox_x);
|
||||
if (w_text == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
if (w_text == 0) {
|
||||
result = DLG_EXIT_ERROR;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
(void) keypad(w_text, TRUE);
|
||||
dlg_draw_box(dialog, tbox_y - MARGIN, tbox_x - MARGIN,
|
||||
@ -656,8 +667,10 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
|
||||
dbox_x = tbox_x;
|
||||
|
||||
w_work = derwin(dialog, dbox_height, dbox_width, dbox_y, dbox_x);
|
||||
if (w_work == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
if (w_work == 0) {
|
||||
result = DLG_EXIT_ERROR;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
(void) keypad(w_work, TRUE);
|
||||
(void) mvwaddstr(dialog, dbox_y - (MARGIN + 1), dbox_x - MARGIN, d_label);
|
||||
@ -675,8 +688,10 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
|
||||
fbox_x = tbox_x + dbox_width + (2 * MARGIN);
|
||||
|
||||
w_work = derwin(dialog, fbox_height, fbox_width, fbox_y, fbox_x);
|
||||
if (w_work == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
if (w_work == 0) {
|
||||
result = DLG_EXIT_ERROR;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
(void) keypad(w_work, TRUE);
|
||||
(void) mvwaddstr(dialog, fbox_y - (MARGIN + 1), fbox_x - MARGIN, f_label);
|
||||
@ -791,7 +806,10 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
|
||||
continue;
|
||||
case DLGK_SELECT:
|
||||
completed = 0;
|
||||
partial = 0;
|
||||
if (partial != 0) {
|
||||
free(partial);
|
||||
partial = 0;
|
||||
}
|
||||
if (state == sFILES && !dselect) {
|
||||
completed = data_of(&f_list);
|
||||
} else if (state == sDIRS) {
|
||||
@ -808,8 +826,10 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
|
||||
offset = (int) strlen(input);
|
||||
dlg_show_string(w_text, input, offset, inputbox_attr,
|
||||
0, 0, tbox_width, 0, first);
|
||||
if (partial != NULL)
|
||||
if (partial != NULL) {
|
||||
free(partial);
|
||||
partial = 0;
|
||||
}
|
||||
continue;
|
||||
} else { /* if (state < sTEXT) */
|
||||
(void) beep();
|
||||
@ -882,6 +902,10 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel
|
||||
dlg_mouse_free_regions();
|
||||
free_list(&d_list, FALSE);
|
||||
free_list(&f_list, FALSE);
|
||||
|
||||
finish:
|
||||
if (partial != 0)
|
||||
free(partial);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
7
guage.c
7
guage.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: guage.c,v 1.64 2011/10/20 23:34:35 tom Exp $
|
||||
* $Id: guage.c,v 1.65 2012/11/30 10:43:31 tom Exp $
|
||||
*
|
||||
* guage.c -- implements the gauge dialog
|
||||
*
|
||||
* Copyright 2000-2010,2011 Thomas E. Dickey
|
||||
* Copyright 2000-2011,2012 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
|
||||
@ -94,6 +94,7 @@ read_data(char *buffer, FILE *fp)
|
||||
result = 0;
|
||||
} else if (fgets(buffer, MY_LEN, fp) != 0) {
|
||||
DLG_TRACE(("read_data:%s", buffer));
|
||||
buffer[MY_LEN] = '\0';
|
||||
dlg_trim_string(buffer);
|
||||
result = 1;
|
||||
} else {
|
||||
@ -182,7 +183,7 @@ handle_input(DIALOG_CALLBACK * cb)
|
||||
MY_OBJ *obj = (MY_OBJ *) cb;
|
||||
bool result;
|
||||
int status;
|
||||
char buf[MY_LEN];
|
||||
char buf[MY_LEN + 1];
|
||||
|
||||
if (dialog_state.pipe_input == 0) {
|
||||
status = -1;
|
||||
|
17
help.c
17
help.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: help.c,v 1.2 2011/06/25 00:27:16 tom Exp $
|
||||
* $Id: help.c,v 1.3 2012/12/04 02:01:10 tom Exp $
|
||||
*
|
||||
* help.c -- implements the help dialog
|
||||
*
|
||||
* Copyright 2011 Thomas E. Dickey
|
||||
* Copyright 2011,2012 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
|
||||
@ -33,11 +33,22 @@ dialog_helpfile(const char *title,
|
||||
int width)
|
||||
{
|
||||
int result = DLG_EXIT_ERROR;
|
||||
DIALOG_VARS save;
|
||||
|
||||
if (!dialog_vars.in_helpfile && file != 0 && *file != '\0') {
|
||||
dlg_save_vars(&save);
|
||||
|
||||
dialog_vars.no_label = NULL;
|
||||
dialog_vars.ok_label = NULL;
|
||||
dialog_vars.help_button = FALSE;
|
||||
dialog_vars.extra_button = FALSE;
|
||||
dialog_vars.nook = FALSE;
|
||||
|
||||
dialog_vars.in_helpfile = TRUE;
|
||||
|
||||
result = dialog_textbox(title, file, height, width);
|
||||
dialog_vars.in_helpfile = FALSE;
|
||||
|
||||
dlg_restore_vars(&save);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
25
inputbox.c
25
inputbox.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: inputbox.c,v 1.74 2012/07/01 18:13:40 Zoltan.Kelemen Exp $
|
||||
* $Id: inputbox.c,v 1.76 2012/12/03 11:46:50 tom Exp $
|
||||
*
|
||||
* inputbox.c -- implements the input box
|
||||
*
|
||||
@ -73,6 +73,7 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width,
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int state;
|
||||
int first;
|
||||
int edited;
|
||||
char *input;
|
||||
WINDOW *dialog;
|
||||
WINDOW *editor;
|
||||
@ -85,6 +86,7 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width,
|
||||
|
||||
/* Set up the initial value */
|
||||
input = dlg_set_result(init);
|
||||
edited = FALSE;
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
@ -138,7 +140,12 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width,
|
||||
editor = dlg_sub_window(dialog, 1, box_width, yorg + box_y, xorg + box_x);
|
||||
dlg_register_window(editor, "inputbox2", binding2);
|
||||
|
||||
dlg_trace_win(dialog);
|
||||
if (*input != '\0') {
|
||||
dlg_show_string(editor, input, chr_offset, inputbox_attr,
|
||||
0, 0, box_width, password, first);
|
||||
wsyncup(editor);
|
||||
wcursyncup(editor);
|
||||
}
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
int edit = 0;
|
||||
|
||||
@ -153,6 +160,13 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width,
|
||||
}
|
||||
|
||||
if (!first) {
|
||||
if (*input != '\0' && !edited) {
|
||||
dlg_show_string(editor, input, chr_offset, inputbox_attr,
|
||||
0, 0, box_width, password, first);
|
||||
wmove(editor, 0, chr_offset);
|
||||
wsyncup(editor);
|
||||
wcursyncup(editor);
|
||||
}
|
||||
key = dlg_mouse_wgetch((state == sTEXT) ? editor : dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
@ -173,9 +187,12 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width,
|
||||
edit = dlg_edit_string(input, &chr_offset, key, fkey, first);
|
||||
|
||||
if (edit) {
|
||||
dlg_show_string(dialog, input, chr_offset, inputbox_attr,
|
||||
box_y, box_x, box_width, password, first);
|
||||
dlg_show_string(editor, input, chr_offset, inputbox_attr,
|
||||
0, 0, box_width, password, first);
|
||||
wsyncup(editor);
|
||||
wcursyncup(editor);
|
||||
first = FALSE;
|
||||
edited = TRUE;
|
||||
continue;
|
||||
} else if (first) {
|
||||
first = FALSE;
|
||||
|
27
inputstr.c
27
inputstr.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: inputstr.c,v 1.70 2011/10/20 23:42:49 tom Exp $
|
||||
* $Id: inputstr.c,v 1.72 2012/12/30 22:11:37 tom Exp $
|
||||
*
|
||||
* inputstr.c -- functions for input/display of a string
|
||||
*
|
||||
* Copyright 2000-2010,2011 Thomas E. Dickey
|
||||
* Copyright 2000-2011,2012 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
|
||||
@ -308,13 +308,17 @@ dlg_count_wchars(const char *string)
|
||||
size_t code;
|
||||
wchar_t *temp = dlg_calloc(wchar_t, len + 1);
|
||||
|
||||
cache.string[part] = '\0';
|
||||
memset(&state, 0, sizeof(state));
|
||||
code = mbsrtowcs(temp, &src, (size_t) part, &state);
|
||||
cache.i_len = ((int) code >= 0) ? wcslen(temp) : 0;
|
||||
cache.string[part] = save;
|
||||
free(temp);
|
||||
save_cache(&cache, string);
|
||||
if (temp != 0) {
|
||||
cache.string[part] = '\0';
|
||||
memset(&state, 0, sizeof(state));
|
||||
code = mbsrtowcs(temp, &src, (size_t) part, &state);
|
||||
cache.i_len = ((int) code >= 0) ? wcslen(temp) : 0;
|
||||
cache.string[part] = save;
|
||||
free(temp);
|
||||
save_cache(&cache, string);
|
||||
} else {
|
||||
cache.i_len = 0;
|
||||
}
|
||||
}
|
||||
result = (int) cache.i_len;
|
||||
} else
|
||||
@ -375,8 +379,9 @@ dlg_find_index(const int *list, int limit, int to_find)
|
||||
for (result = 0; result <= limit; ++result) {
|
||||
if (to_find == list[result]
|
||||
|| result == limit
|
||||
|| to_find < list[result + 1])
|
||||
|| ((result < limit) && (to_find < list[result + 1]))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -529,7 +534,7 @@ dlg_edit_string(char *string, int *chr_offset, int key, int fkey, bool force)
|
||||
edit = force;
|
||||
break;
|
||||
case DLGK_GRID_LEFT:
|
||||
if (*chr_offset)
|
||||
if (*chr_offset && offset > 0)
|
||||
*chr_offset = indx[offset - 1];
|
||||
break;
|
||||
case DLGK_GRID_RIGHT:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: makefile.in,v 1.82 2012/02/16 00:35:37 Li-Wen.Hsu Exp $
|
||||
# $Id: makefile.in,v 1.83 2012/10/06 14:05:14 tom Exp $
|
||||
# template makefile for DIALOG
|
||||
##############################################################################
|
||||
# Copyright (c) 1999-2011,2012 Thomas E. Dickey #
|
||||
@ -35,6 +35,7 @@ VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datarootdir = @datarootdir@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
|
420
menubox.c
420
menubox.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: menubox.c,v 1.132 2012/07/01 16:30:04 Zoltan.Kelemen Exp $
|
||||
* $Id: menubox.c,v 1.145 2012/12/30 21:11:02 tom Exp $
|
||||
*
|
||||
* menubox.c -- implements the menu box
|
||||
*
|
||||
@ -27,138 +27,97 @@
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
static int menu_width, tag_x, item_x;
|
||||
|
||||
typedef enum {
|
||||
Unselected = 0,
|
||||
Selected,
|
||||
Editing
|
||||
} Mode;
|
||||
|
||||
typedef struct {
|
||||
/* the outer-window */
|
||||
WINDOW *dialog;
|
||||
int box_y;
|
||||
int box_x;
|
||||
int tag_x;
|
||||
int item_x;
|
||||
int menu_height;
|
||||
int menu_width;
|
||||
/* the inner-window */
|
||||
WINDOW *menu;
|
||||
DIALOG_LISTITEM *items;
|
||||
int item_no;
|
||||
} ALL_DATA;
|
||||
|
||||
#define MIN_HIGH (1 + (5 * MARGIN))
|
||||
|
||||
#define INPUT_ROWS 3 /* rows per inputmenu entry */
|
||||
|
||||
#define LLEN(n) ((n) * MENUBOX_TAGS)
|
||||
#define ItemName(i) items[LLEN(i)]
|
||||
#define ItemText(i) items[LLEN(i) + 1]
|
||||
#define ItemHelp(i) items[LLEN(i) + 2]
|
||||
|
||||
#define RowHeight(i) (is_inputmenu ? ((i) * INPUT_ROWS) : ((i) * 1))
|
||||
#define ItemToRow(i) (is_inputmenu ? ((i) * INPUT_ROWS + 1) : (i))
|
||||
#define RowToItem(i) (is_inputmenu ? ((i) / INPUT_ROWS + 0) : (i))
|
||||
|
||||
static void
|
||||
print_arrows(WINDOW *win,
|
||||
int box_x,
|
||||
int box_y,
|
||||
int scrollamt,
|
||||
int max_choice,
|
||||
int item_no,
|
||||
int menu_height)
|
||||
{
|
||||
dlg_draw_scrollbar(win,
|
||||
scrollamt,
|
||||
scrollamt,
|
||||
scrollamt + max_choice,
|
||||
item_no,
|
||||
box_x,
|
||||
box_x + menu_width,
|
||||
box_y,
|
||||
box_y + menu_height + 1,
|
||||
menubox_border2_attr,
|
||||
menubox_border_attr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the tag of a menu-item
|
||||
*/
|
||||
static void
|
||||
print_tag(WINDOW *win,
|
||||
DIALOG_LISTITEM * item,
|
||||
int choice,
|
||||
Mode selected,
|
||||
bool is_inputmenu)
|
||||
{
|
||||
int my_x = item_x;
|
||||
int my_y = ItemToRow(choice);
|
||||
int tag_width = (my_x - tag_x - GUTTER);
|
||||
const int *indx;
|
||||
int limit;
|
||||
int prefix;
|
||||
|
||||
indx = dlg_index_wchars(item->name);
|
||||
prefix = (indx[1] - indx[0]);
|
||||
|
||||
/* highlight first char of the tag to be special */
|
||||
(void) wmove(win, my_y, tag_x);
|
||||
wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
|
||||
if (strlen(item->name) != 0)
|
||||
(void) waddnstr(win, item->name, prefix);
|
||||
/* print rest of the string */
|
||||
wattrset(win, selected ? tag_selected_attr : tag_attr);
|
||||
if ((int) strlen(item->name) > prefix) {
|
||||
limit = dlg_limit_columns(item->name, tag_width, 1);
|
||||
if (limit > 0)
|
||||
(void) waddnstr(win, item->name + indx[1], indx[limit] - indx[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print menu item
|
||||
*/
|
||||
static void
|
||||
print_item(WINDOW *win,
|
||||
DIALOG_LISTITEM * items,
|
||||
print_item(ALL_DATA * data,
|
||||
WINDOW *win,
|
||||
DIALOG_LISTITEM * item,
|
||||
int choice,
|
||||
Mode selected,
|
||||
bool is_inputmenu)
|
||||
{
|
||||
chtype save = dlg_get_attrs(win);
|
||||
int n;
|
||||
int my_width = menu_width;
|
||||
int my_x = item_x;
|
||||
int climit = (data->item_x - data->tag_x - GUTTER);
|
||||
int my_width = data->menu_width;
|
||||
int my_x = data->item_x;
|
||||
int my_y = ItemToRow(choice);
|
||||
chtype attr = A_NORMAL;
|
||||
chtype textchar;
|
||||
bool both = (!dialog_vars.no_tags && !dialog_vars.no_items);
|
||||
bool first = TRUE;
|
||||
chtype bordchar;
|
||||
const char *show = (dialog_vars.no_items
|
||||
? item->name
|
||||
: item->text);
|
||||
|
||||
switch (selected) {
|
||||
default:
|
||||
case Unselected:
|
||||
textchar = item_attr;
|
||||
bordchar = item_attr;
|
||||
break;
|
||||
case Selected:
|
||||
textchar = item_selected_attr;
|
||||
bordchar = item_selected_attr;
|
||||
break;
|
||||
case Editing:
|
||||
textchar = inputbox_attr;
|
||||
bordchar = dialog_attr;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Clear 'residue' of last item and mark current current item */
|
||||
if (is_inputmenu) {
|
||||
wattrset(win, (selected != Unselected) ? item_selected_attr : item_attr);
|
||||
(void) wattrset(win, (selected != Unselected) ? item_selected_attr : item_attr);
|
||||
for (n = my_y - 1; n < my_y + INPUT_ROWS - 1; n++) {
|
||||
wmove(win, n, 0);
|
||||
wprintw(win, "%*s", my_width, " ");
|
||||
}
|
||||
} else {
|
||||
wattrset(win, menubox_attr);
|
||||
(void) wattrset(win, menubox_attr);
|
||||
wmove(win, my_y, 0);
|
||||
wprintw(win, "%*s", my_width, " ");
|
||||
}
|
||||
|
||||
print_tag(win, items, choice, selected, is_inputmenu);
|
||||
/* highlight first char of the tag to be special */
|
||||
if (both) {
|
||||
(void) wmove(win, my_y, data->tag_x);
|
||||
dlg_print_listitem(win, item->name, climit, first, selected);
|
||||
first = FALSE;
|
||||
}
|
||||
|
||||
/* Draw the input field box (only for inputmenu) */
|
||||
(void) wmove(win, my_y, my_x);
|
||||
if (is_inputmenu) {
|
||||
my_width -= 1;
|
||||
dlg_draw_box(win, my_y - 1, my_x, INPUT_ROWS, my_width - my_x - tag_x,
|
||||
dlg_draw_box(win, my_y - 1, my_x, INPUT_ROWS, my_width - my_x - data->tag_x,
|
||||
bordchar,
|
||||
bordchar);
|
||||
my_width -= 1;
|
||||
@ -167,25 +126,24 @@ print_item(WINDOW *win,
|
||||
|
||||
/* print actual item */
|
||||
wmove(win, my_y, my_x);
|
||||
wattrset(win, textchar);
|
||||
dlg_print_text(win, items->text, my_width - my_x, &attr);
|
||||
dlg_print_listitem(win, show, my_width - my_x, first, selected);
|
||||
|
||||
if (selected) {
|
||||
dlg_item_help(items->help);
|
||||
dlg_item_help(item->help);
|
||||
}
|
||||
wattrset(win, save);
|
||||
(void) wattrset(win, save);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow the user to edit the text of a menu entry.
|
||||
*/
|
||||
static int
|
||||
input_menu_edit(WINDOW *win,
|
||||
input_menu_edit(ALL_DATA * data,
|
||||
DIALOG_LISTITEM * items,
|
||||
int choice,
|
||||
char **resultp)
|
||||
{
|
||||
chtype save = dlg_get_attrs(win);
|
||||
chtype save = dlg_get_attrs(data->menu);
|
||||
char *result;
|
||||
int offset = 0;
|
||||
int key = 0, fkey = 0;
|
||||
@ -203,15 +161,17 @@ input_menu_edit(WINDOW *win,
|
||||
result[0] = '\0';
|
||||
strcpy(result, items->text);
|
||||
|
||||
print_item(win, items, choice, Editing, TRUE);
|
||||
print_item(data, data->menu, items, choice, Editing, TRUE);
|
||||
|
||||
/* taken out of inputbox.c - but somewhat modified */
|
||||
for (;;) {
|
||||
if (!first)
|
||||
key = dlg_mouse_wgetch(win, &fkey);
|
||||
key = dlg_mouse_wgetch(data->menu, &fkey);
|
||||
if (dlg_edit_string(result, &offset, key, fkey, first)) {
|
||||
dlg_show_string(win, result, offset, inputbox_attr,
|
||||
y, item_x + 1, menu_width - item_x - 3,
|
||||
dlg_show_string(data->menu, result, offset, inputbox_attr,
|
||||
y,
|
||||
data->item_x + 1,
|
||||
data->menu_width - data->item_x - 3,
|
||||
FALSE, first);
|
||||
first = FALSE;
|
||||
} else if (key == ESC || key == TAB) {
|
||||
@ -221,8 +181,8 @@ input_menu_edit(WINDOW *win,
|
||||
break;
|
||||
}
|
||||
}
|
||||
print_item(win, items, choice, Selected, TRUE);
|
||||
wattrset(win, save);
|
||||
print_item(data, data->menu, items, choice, Selected, TRUE);
|
||||
(void) wattrset(data->menu, save);
|
||||
|
||||
*resultp = result;
|
||||
return code;
|
||||
@ -270,6 +230,63 @@ dlg_dummy_menutext(DIALOG_LISTITEM * items, int current, char *newtext)
|
||||
return DLG_EXIT_ERROR;
|
||||
}
|
||||
|
||||
static void
|
||||
print_menu(ALL_DATA * data, int choice, int scrollamt, int max_choice, bool is_inputmenu)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(data,
|
||||
data->menu,
|
||||
&data->items[i + scrollamt],
|
||||
i,
|
||||
(i == choice) ? Selected : Unselected,
|
||||
is_inputmenu);
|
||||
}
|
||||
|
||||
/* Clean bottom lines */
|
||||
if (is_inputmenu) {
|
||||
int spare_lines, x_count;
|
||||
spare_lines = data->menu_height % INPUT_ROWS;
|
||||
(void) wattrset(data->menu, menubox_attr);
|
||||
for (; spare_lines; spare_lines--) {
|
||||
wmove(data->menu, data->menu_height - spare_lines, 0);
|
||||
for (x_count = 0; x_count < data->menu_width;
|
||||
x_count++) {
|
||||
waddch(data->menu, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(void) wnoutrefresh(data->menu);
|
||||
|
||||
dlg_draw_scrollbar(data->dialog,
|
||||
scrollamt,
|
||||
scrollamt,
|
||||
scrollamt + max_choice,
|
||||
data->item_no,
|
||||
data->box_x,
|
||||
data->box_x + data->menu_width,
|
||||
data->box_y,
|
||||
data->box_y + data->menu_height + 1,
|
||||
menubox_border2_attr,
|
||||
menubox_border_attr);
|
||||
}
|
||||
|
||||
static bool
|
||||
check_hotkey(DIALOG_LISTITEM * items, int choice)
|
||||
{
|
||||
bool result = FALSE;
|
||||
|
||||
if (dlg_match_char(dlg_last_getc(),
|
||||
(dialog_vars.no_tags
|
||||
? items[choice].text
|
||||
: items[choice].name))) {
|
||||
result = TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an alternate interface to 'menu' which allows the application
|
||||
* to read the list item states back directly without putting them in the
|
||||
@ -320,7 +337,8 @@ dlg_menu(const char *title,
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
int i, j, x, y, cur_x, cur_y, box_x, box_y;
|
||||
ALL_DATA all;
|
||||
int i, j, x, y, cur_x, cur_y;
|
||||
int key = 0, fkey;
|
||||
int button = dialog_state.visit_items ? -1 : dlg_default_button();
|
||||
int choice = dlg_default_listitem(items);
|
||||
@ -328,13 +346,16 @@ dlg_menu(const char *title,
|
||||
int scrollamt = 0;
|
||||
int max_choice;
|
||||
int found;
|
||||
int use_height, use_width, name_width, text_width;
|
||||
int use_width, name_width, text_width, list_width;
|
||||
WINDOW *dialog, *menu;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
bool is_inputmenu = ((rename_menutext != 0)
|
||||
&& (rename_menutext != dlg_dummy_menutext));
|
||||
|
||||
all.items = items;
|
||||
all.item_no = item_no;
|
||||
|
||||
dlg_does_output();
|
||||
dlg_tab_correct_str(prompt);
|
||||
|
||||
@ -342,15 +363,17 @@ dlg_menu(const char *title,
|
||||
retry:
|
||||
#endif
|
||||
|
||||
use_height = menu_height;
|
||||
all.menu_height = menu_height;
|
||||
use_width = dlg_calc_list_width(item_no, items) + 10;
|
||||
use_width = MAX(26, use_width);
|
||||
if (use_height == 0) {
|
||||
if (all.menu_height == 0) {
|
||||
/* calculate height without items (4) */
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, use_width);
|
||||
dlg_calc_listh(&height, &use_height, item_no);
|
||||
dlg_calc_listh(&height, &all.menu_height, item_no);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, use_width);
|
||||
dlg_auto_size(title, prompt,
|
||||
&height, &width,
|
||||
MIN_HIGH + all.menu_height, use_width);
|
||||
}
|
||||
dlg_button_layout(buttons, &width);
|
||||
dlg_print_size(height, width);
|
||||
@ -360,6 +383,8 @@ dlg_menu(const char *title,
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
all.dialog = dialog;
|
||||
|
||||
dlg_register_window(dialog, "menubox", binding);
|
||||
dlg_register_buttons(dialog, "menubox", buttons);
|
||||
|
||||
@ -369,38 +394,42 @@ dlg_menu(const char *title,
|
||||
dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
(void) wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
menu_width = width - 6;
|
||||
all.menu_width = width - 6;
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - menu_width) / 2 - 1;
|
||||
all.box_y = cur_y + 1;
|
||||
all.box_x = (width - all.menu_width) / 2 - 1;
|
||||
|
||||
/*
|
||||
* After displaying the prompt, we know how much space we really have.
|
||||
* Limit the list to avoid overwriting the ok-button.
|
||||
*/
|
||||
if (use_height + MIN_HIGH > height - cur_y)
|
||||
use_height = height - MIN_HIGH - cur_y;
|
||||
if (use_height <= 0)
|
||||
use_height = 1;
|
||||
if (all.menu_height + MIN_HIGH > height - cur_y)
|
||||
all.menu_height = height - MIN_HIGH - cur_y;
|
||||
if (all.menu_height <= 0)
|
||||
all.menu_height = 1;
|
||||
|
||||
/* Find out maximal number of displayable items at once. */
|
||||
max_choice = MIN(use_height,
|
||||
max_choice = MIN(all.menu_height,
|
||||
RowHeight(item_no));
|
||||
if (is_inputmenu)
|
||||
max_choice /= INPUT_ROWS;
|
||||
|
||||
/* create new window for the menu */
|
||||
menu = dlg_sub_window(dialog, use_height, menu_width,
|
||||
y + box_y + 1,
|
||||
x + box_x + 1);
|
||||
menu = dlg_sub_window(dialog, all.menu_height, all.menu_width,
|
||||
y + all.box_y + 1,
|
||||
x + all.box_x + 1);
|
||||
all.menu = menu;
|
||||
|
||||
dlg_register_window(menu, "menu", binding2);
|
||||
dlg_register_buttons(menu, "menu", buttons);
|
||||
|
||||
/* draw a box around the menu items */
|
||||
dlg_draw_box(dialog, box_y, box_x, use_height + 2, menu_width + 2,
|
||||
dlg_draw_box(dialog,
|
||||
all.box_y, all.box_x,
|
||||
all.menu_height + 2, all.menu_width + 2,
|
||||
menubox_border_attr, menubox_border2_attr);
|
||||
|
||||
name_width = 0;
|
||||
@ -420,50 +449,58 @@ dlg_menu(const char *title,
|
||||
*
|
||||
* FIXME: the gutter width and name/list ratio should be configurable.
|
||||
*/
|
||||
use_width = (menu_width - GUTTER);
|
||||
if (text_width + name_width > use_width) {
|
||||
int need = (int) (0.30 * use_width);
|
||||
if (name_width > need) {
|
||||
int want = (int) (use_width
|
||||
* ((double) name_width)
|
||||
/ (text_width + name_width));
|
||||
name_width = (want > need) ? want : need;
|
||||
use_width = (all.menu_width - GUTTER);
|
||||
if (dialog_vars.no_tags) {
|
||||
list_width = MIN(use_width, text_width);
|
||||
} else if (dialog_vars.no_items) {
|
||||
list_width = MIN(use_width, name_width);
|
||||
} else {
|
||||
if (text_width >= 0
|
||||
&& name_width >= 0
|
||||
&& use_width > 0
|
||||
&& text_width + name_width > use_width) {
|
||||
int need = (int) (0.30 * use_width);
|
||||
if (name_width > need) {
|
||||
int want = (int) (use_width
|
||||
* ((double) name_width)
|
||||
/ (text_width + name_width));
|
||||
name_width = (want > need) ? want : need;
|
||||
}
|
||||
text_width = use_width - name_width;
|
||||
}
|
||||
text_width = use_width - name_width;
|
||||
list_width = (text_width + name_width);
|
||||
}
|
||||
|
||||
tag_x = (is_inputmenu
|
||||
? 0
|
||||
: (use_width - text_width - name_width) / 2);
|
||||
item_x = name_width + tag_x + GUTTER;
|
||||
all.tag_x = (is_inputmenu
|
||||
? 0
|
||||
: (use_width - list_width) / 2);
|
||||
all.item_x = ((dialog_vars.no_tags
|
||||
? 0
|
||||
: (dialog_vars.no_items
|
||||
? 0
|
||||
: (GUTTER + name_width)))
|
||||
+ all.tag_x);
|
||||
|
||||
if (choice - scrollamt >= max_choice) {
|
||||
scrollamt = choice - (max_choice - 1);
|
||||
choice = max_choice - 1;
|
||||
}
|
||||
|
||||
/* Print the menu */
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(menu,
|
||||
&items[i + scrollamt],
|
||||
i,
|
||||
(i == choice) ? Selected : Unselected,
|
||||
is_inputmenu);
|
||||
}
|
||||
(void) wnoutrefresh(menu);
|
||||
print_menu(&all, choice, scrollamt, max_choice, is_inputmenu);
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(box_y + 1, box_x, use_height + 2, menu_width + 2,
|
||||
dlg_mouse_mkbigregion(all.box_y + 1, all.box_x,
|
||||
all.menu_height + 2, all.menu_width + 2,
|
||||
KEY_MAX, 1, 1, 1 /* by lines */ );
|
||||
|
||||
print_arrows(dialog, box_x, box_y, scrollamt, max_choice, item_no, use_height);
|
||||
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
|
||||
dlg_trace_win(dialog);
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
if (button < 0) /* --visit-items */
|
||||
wmove(dialog, box_y + ItemToRow(choice) + 1, box_x + tag_x + 1);
|
||||
wmove(dialog,
|
||||
all.box_y + ItemToRow(choice) + 1,
|
||||
all.box_x + all.tag_x + 1);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
@ -500,7 +537,7 @@ dlg_menu(const char *title,
|
||||
*/
|
||||
if (button < 0 || !dialog_state.visit_items) {
|
||||
for (j = scrollamt + choice + 1; j < item_no; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), items[j].name)) {
|
||||
if (check_hotkey(items, j)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
@ -508,7 +545,7 @@ dlg_menu(const char *title,
|
||||
}
|
||||
if (!found) {
|
||||
for (j = 0; j <= scrollamt + choice; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), items[j].name)) {
|
||||
if (check_hotkey(items, j)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
@ -578,95 +615,17 @@ dlg_menu(const char *title,
|
||||
if (i != choice) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (i < 0 || i >= max_choice) {
|
||||
#if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR < 5
|
||||
/*
|
||||
* Using wscrl to assist ncurses scrolling is not needed
|
||||
* in version 5.x
|
||||
*/
|
||||
if (i == -1) {
|
||||
if (use_height > 1) {
|
||||
/* De-highlight current first item */
|
||||
print_item(menu,
|
||||
&items[scrollamt],
|
||||
0, Unselected, is_inputmenu);
|
||||
scrollok(menu, TRUE);
|
||||
wscrl(menu, -RowHeight(1));
|
||||
scrollok(menu, FALSE);
|
||||
}
|
||||
scrollamt--;
|
||||
print_item(menu,
|
||||
&items[scrollamt],
|
||||
0, Selected, is_inputmenu);
|
||||
} else if (i == max_choice) {
|
||||
if (use_height > 1) {
|
||||
/* De-highlight current last item before scrolling up */
|
||||
print_item(menu,
|
||||
&items[scrollamt + max_choice - 1],
|
||||
max_choice - 1,
|
||||
Unselected,
|
||||
is_inputmenu);
|
||||
scrollok(menu, TRUE);
|
||||
wscrl(menu, RowHeight(1));
|
||||
scrollok(menu, FALSE);
|
||||
}
|
||||
scrollamt++;
|
||||
print_item(menu,
|
||||
&items[scrollamt + max_choice - 1],
|
||||
max_choice - 1, TRUE,
|
||||
is_inputmenu);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(menu,
|
||||
&items[scrollamt + i],
|
||||
i,
|
||||
(i == choice) ? Selected : Unselected,
|
||||
is_inputmenu);
|
||||
}
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
/* Clean bottom lines */
|
||||
if (is_inputmenu) {
|
||||
int spare_lines, x_count;
|
||||
spare_lines = use_height % INPUT_ROWS;
|
||||
wattrset(menu, menubox_attr);
|
||||
for (; spare_lines; spare_lines--) {
|
||||
wmove(menu, use_height - spare_lines, 0);
|
||||
for (x_count = 0; x_count < menu_width;
|
||||
x_count++) {
|
||||
waddch(menu, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
(void) wnoutrefresh(menu);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
print_menu(&all, choice, scrollamt, max_choice, is_inputmenu);
|
||||
} else {
|
||||
/* De-highlight current item */
|
||||
print_item(menu,
|
||||
&items[scrollamt + choice],
|
||||
choice,
|
||||
Unselected,
|
||||
is_inputmenu);
|
||||
/* Highlight new item */
|
||||
choice = i;
|
||||
print_item(menu,
|
||||
&items[scrollamt + choice],
|
||||
choice,
|
||||
Selected,
|
||||
is_inputmenu);
|
||||
(void) wnoutrefresh(menu);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
print_menu(&all, choice, scrollamt, max_choice, is_inputmenu);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
}
|
||||
@ -717,7 +676,7 @@ dlg_menu(const char *title,
|
||||
if (is_inputmenu && result == DLG_EXIT_EXTRA) {
|
||||
char *tmp;
|
||||
|
||||
if (input_menu_edit(menu,
|
||||
if (input_menu_edit(&all,
|
||||
&items[scrollamt + choice],
|
||||
choice,
|
||||
&tmp)) {
|
||||
@ -729,7 +688,8 @@ dlg_menu(const char *title,
|
||||
}
|
||||
} else {
|
||||
result = DLG_EXIT_UNKNOWN;
|
||||
print_item(menu,
|
||||
print_item(&all,
|
||||
menu,
|
||||
&items[scrollamt + choice],
|
||||
choice,
|
||||
Selected,
|
||||
@ -786,17 +746,19 @@ dialog_menu(const char *title,
|
||||
{
|
||||
int result;
|
||||
int choice;
|
||||
int i;
|
||||
int i, j;
|
||||
DIALOG_LISTITEM *listitems;
|
||||
|
||||
listitems = dlg_calloc(DIALOG_LISTITEM, (size_t) item_no + 1);
|
||||
assert_ptr(listitems, "dialog_menu");
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
listitems[i].name = ItemName(i);
|
||||
listitems[i].text = ItemText(i);
|
||||
for (i = j = 0; i < item_no; ++i) {
|
||||
listitems[i].name = items[j++];
|
||||
listitems[i].text = (dialog_vars.no_items
|
||||
? dlg_strempty()
|
||||
: items[j++]);
|
||||
listitems[i].help = ((dialog_vars.item_help)
|
||||
? ItemHelp(i)
|
||||
? items[j++]
|
||||
: dlg_strempty());
|
||||
}
|
||||
dlg_align_columns(&listitems[0].text, sizeof(DIALOG_LISTITEM), item_no);
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: mixedform.c,v 1.9 2011/10/10 00:49:43 tom Exp $
|
||||
* $Id: mixedform.c,v 1.10 2013/03/17 15:03:41 tom Exp $
|
||||
*
|
||||
* mixedform.c -- implements the mixed form (i.e, typed pairs label/editbox)
|
||||
*
|
||||
* Copyright 2007-2010,2011 Thomas E. Dickey
|
||||
* Copyright 2007-2011,2013 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
|
||||
@ -112,6 +112,7 @@ dialog_mixedform(const char *title,
|
||||
dlg_add_separator();
|
||||
}
|
||||
}
|
||||
dlg_add_last_key(-1);
|
||||
}
|
||||
|
||||
dlg_free_formitems(listitems);
|
||||
|
11
mixedgauge.c
11
mixedgauge.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: mixedgauge.c,v 1.29 2011/10/20 23:35:31 tom Exp $
|
||||
* $Id: mixedgauge.c,v 1.30 2012/11/18 16:30:20 tom Exp $
|
||||
*
|
||||
* mixedgauge.c -- implements the mixedgauge dialog
|
||||
*
|
||||
* Copyright 2007-2010,2011 Thomas E. Dickey
|
||||
* Copyright 2007-2011,2012 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
|
||||
@ -121,11 +121,8 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg)
|
||||
const char *status = "";
|
||||
char *freeMe = 0;
|
||||
|
||||
if (win) {
|
||||
bm -= (2 * MARGIN);
|
||||
}
|
||||
if (win != 0)
|
||||
getyx(win, last_y, last_x);
|
||||
bm -= (2 * MARGIN);
|
||||
getyx(win, last_y, last_x);
|
||||
for (item = 0; item < dlg->item_no; ++item) {
|
||||
chtype attr = A_NORMAL;
|
||||
|
||||
|
25
mouse.c
25
mouse.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: mouse.c,v 1.18 2007/02/22 21:51:38 tom Exp $
|
||||
* $Id: mouse.c,v 1.20 2012/12/21 10:00:30 tom Exp $
|
||||
*
|
||||
* mouse.c -- mouse support for dialog
|
||||
*
|
||||
* Copyright 2002-2006,2007 Thomas E. Dickey
|
||||
* Copyright 2002-2007,2012 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
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
#if USE_MOUSE
|
||||
|
||||
static int basex, basey;
|
||||
static int basex, basey, basecode;
|
||||
|
||||
static mseRegion *regionList = NULL;
|
||||
|
||||
@ -51,6 +51,12 @@ dlg_mouse_setbase(int x, int y)
|
||||
basey = y;
|
||||
}
|
||||
|
||||
void
|
||||
dlg_mouse_setcode(int code)
|
||||
{
|
||||
basecode = code;
|
||||
}
|
||||
|
||||
void
|
||||
dlg_mouse_mkbigregion(int y, int x,
|
||||
int height, int width,
|
||||
@ -79,7 +85,7 @@ dlg_mouse_mkregion(int y, int x, int height, int width, int code)
|
||||
{
|
||||
mseRegion *butPtr;
|
||||
|
||||
if ((butPtr = find_region_by_code(code)) == 0) {
|
||||
if ((butPtr = find_region_by_code(basecode + code)) == 0) {
|
||||
butPtr = dlg_malloc(mseRegion, 1);
|
||||
assert_ptr(butPtr, "dlg_mouse_mkregion");
|
||||
butPtr->next = regionList;
|
||||
@ -93,7 +99,7 @@ dlg_mouse_mkregion(int y, int x, int height, int width, int code)
|
||||
butPtr->Y = basey + y + height;
|
||||
butPtr->x = basex + x;
|
||||
butPtr->X = basex + x + width;
|
||||
butPtr->code = code;
|
||||
butPtr->code = basecode + code;
|
||||
}
|
||||
return butPtr;
|
||||
}
|
||||
@ -105,12 +111,15 @@ any_mouse_region(int y, int x, int small)
|
||||
mseRegion *butPtr;
|
||||
|
||||
for (butPtr = regionList; butPtr; butPtr = butPtr->next) {
|
||||
if (small ^ (butPtr->code >= 0))
|
||||
if (small ^ (butPtr->code >= 0)) {
|
||||
continue;
|
||||
if (y < butPtr->y || y >= butPtr->Y)
|
||||
}
|
||||
if (y < butPtr->y || y >= butPtr->Y) {
|
||||
continue;
|
||||
if (x < butPtr->x || x >= butPtr->X)
|
||||
}
|
||||
if (x < butPtr->x || x >= butPtr->X) {
|
||||
continue;
|
||||
}
|
||||
break; /* found */
|
||||
}
|
||||
return butPtr;
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: mousewget.c,v 1.21 2008/03/16 20:09:03 tom Exp $
|
||||
* $Id: mousewget.c,v 1.22 2012/11/30 10:23:49 tom Exp $
|
||||
*
|
||||
* mousewget.c -- mouse/wgetch support for dialog
|
||||
*
|
||||
* Copyright 2000-2006,2008 Thomas E. Dickey
|
||||
* Copyright 2000-2008,2012 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,7 +37,7 @@ mouse_wgetch(WINDOW *win, int *fkey, bool ignore_errs)
|
||||
#if USE_MOUSE
|
||||
|
||||
mouse_err = FALSE;
|
||||
if (fkey && (key == KEY_MOUSE)) {
|
||||
if (key == KEY_MOUSE) {
|
||||
MEVENT event;
|
||||
mseRegion *p;
|
||||
|
||||
|
4
msgbox.c
4
msgbox.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: msgbox.c,v 1.74 2012/07/06 16:53:53 tom Exp $
|
||||
* $Id: msgbox.c,v 1.75 2012/12/01 01:48:08 tom Exp $
|
||||
*
|
||||
* msgbox.c -- implements the message box and info box
|
||||
*
|
||||
@ -100,7 +100,7 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width,
|
||||
dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
(void) wattrset(dialog, dialog_attr);
|
||||
|
||||
if (pauseopt) {
|
||||
dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr);
|
||||
|
@ -1,3 +1,23 @@
|
||||
cdialog (20130523) unstable; urgency=low
|
||||
|
||||
* minor fixes
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Thu, 23 May 2013 19:25:01 -0400
|
||||
|
||||
cdialog (20130315) unstable; urgency=low
|
||||
|
||||
* minor fixes
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Fri, 15 Mar 2013 04:41:20 -0400
|
||||
|
||||
cdialog (20121230) unstable; urgency=low
|
||||
|
||||
* new widgets
|
||||
* coverity fixes
|
||||
* configure-script updates
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 06 Oct 2012 09:19:29 -0400
|
||||
|
||||
cdialog (20120706) unstable; urgency=high
|
||||
|
||||
* fix regression in msgbox (ArchLinux #30574)
|
||||
|
@ -1,9 +1,9 @@
|
||||
Summary: dialog - display dialog boxes from shell scripts
|
||||
%define AppProgram dialog
|
||||
%define AppVersion 1.1
|
||||
%define AppRelease 20120706
|
||||
%define AppVersion 1.2
|
||||
%define AppRelease 20130523
|
||||
%define ActualProg c%{AppProgram}
|
||||
# $XTermId: dialog.spec,v 1.38 2012/07/06 16:51:44 tom Exp $
|
||||
# $XTermId: dialog.spec,v 1.50 2013/05/24 00:13:31 tom Exp $
|
||||
Name: %{ActualProg}
|
||||
Version: %{AppVersion}
|
||||
Release: %{AppRelease}
|
||||
@ -28,6 +28,8 @@ compiled into dialog):
|
||||
This package installs as "cdialog" to avoid conflict with other packages.
|
||||
%prep
|
||||
|
||||
%define debug_package %{nil}
|
||||
|
||||
%setup -q -n %{AppProgram}-%{AppVersion}-%{AppRelease}
|
||||
|
||||
%build
|
||||
|
111
po/an.po
Normal file
111
po/an.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Dialog
|
||||
# Copyright 2003-2007,2008 # Thomas Dickey
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Daniel Martinez <entaltoaragon@gmail.com>, 2013.
|
||||
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: 2013-02-19 17:50+0100\n"
|
||||
"Last-Translator: Daniel Martinez <entaltoaragon@gmail.com>\n"
|
||||
"Language-Team: Aragonese <softaragones@googlegroups.com>\n"
|
||||
"Language: an\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Sí"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Acceptar"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Salir"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Aduya"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mes"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Anyo"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Renombrar"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Directorios"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fichers"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Finalizau con exito"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Falló"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Pasau"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Completau"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Comprebau"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Feito"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Blincau"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "En progreso"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Progreso total"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Buscar"
|
58
po/gl.po
58
po/gl.po
@ -1,68 +1,76 @@
|
||||
# Galician translation of dialog
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Mensaxes en galego para dialog.
|
||||
# Copyright 2003-2006,2007 Thomas Dickey
|
||||
# Copyright 2003-2006, 2007 Thomas Dickey
|
||||
# Copyright 2012 Leandro Regueiro
|
||||
#
|
||||
# Diego Pérez Montes <kabute@gulo.org>, 2008
|
||||
# Leandro Regueiro <leandro.regueiro@gmail.com>, 2012.
|
||||
#
|
||||
# Proxecto Trasno - Adaptación do software libre á lingua galega: Se desexas
|
||||
# colaborar connosco, podes atopar máis información en <http://www.trasno.net>
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-01-16 17:57-0500\n"
|
||||
"PO-Revision-Date: 2008-05-13 23:57+0100\n"
|
||||
"Last-Translator: Diego Pérez Montes <kabute@gulo.org>\n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2012-11-10 13:53+0200\n"
|
||||
"Last-Translator: Leandro Regueiro <leandro.regueiro@gmail.com>\n"
|
||||
"Language-Team: Galician <proxecto@trasno.net>\n"
|
||||
"Language: gl\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Virtaal 0.7.0\n"
|
||||
|
||||
#: buttons.c:387
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Sí"
|
||||
msgstr "Si"
|
||||
|
||||
#: buttons.c:395
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Non"
|
||||
|
||||
#: buttons.c:403
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Aceptar"
|
||||
|
||||
#: buttons.c:411
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:419
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "SAÍR"
|
||||
|
||||
#: buttons.c:427
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Suplementario"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:435
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Axuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:298
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mes"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:318
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Ano"
|
||||
|
||||
#: dialog.c:756
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Renomear"
|
||||
|
||||
#: fselect.c:571
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Directorios"
|
||||
|
||||
#: fselect.c:572
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Ficheiros"
|
||||
|
||||
@ -96,16 +104,16 @@ msgstr "Omitido"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "En Progreso"
|
||||
msgstr "En progreso"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Non Dispoñible"
|
||||
msgstr "Non dispoñíbel"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Progreso Total"
|
||||
msgstr "Progreso total"
|
||||
|
||||
#: textbox.c:468
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Procurar"
|
||||
msgstr "Buscar"
|
||||
|
111
po/ia.po
Normal file
111
po/ia.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Interlingua translation of Dialog
|
||||
# Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Nik Kalach <nik.kalach@inbox.ru>, 2012.
|
||||
#
|
||||
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: 2012-12-04 00:56+0400\n"
|
||||
"Last-Translator: Nik Kalach <nik.kalach@inbox.ru>\n"
|
||||
"Language-Team: Interlingua <translation-team-ia@lists.sourceforge.net>\n"
|
||||
"Language: ia\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 "Si"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Annullar"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "SORTIR"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Adjuta"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mense"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Anno"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Renominar"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Directorios"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Files"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Succedite"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Fallite"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Passate"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Completate"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Controlate"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Facite"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Saltate"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "In curso"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Progresso general"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Cerca"
|
36
po/zh_TW.po
36
po/zh_TW.po
@ -1,15 +1,15 @@
|
||||
# Traditional Chinese Messages for dialog.
|
||||
# Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Wei-Lun Chao <chaoweilun@gmail.com>, 2005, 2007.
|
||||
# Wei-Lun Chao <bluebat@member.fsf.org>, 2005, 2007, 2013.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-01-16 17:57-0500\n"
|
||||
"PO-Revision-Date: 2007-12-19 23:39+0800\n"
|
||||
"Last-Translator: Wei-Lun Chao <chaoweilun@gmail.com>\n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2013-02-12 23:39+0800\n"
|
||||
"Last-Translator: Wei-Lun Chao <bluebat@member.fsf.org>\n"
|
||||
"Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\n"
|
||||
"Language: zh_TW\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -17,53 +17,53 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#: buttons.c:387
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "是"
|
||||
|
||||
#: buttons.c:395
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "否"
|
||||
|
||||
#: buttons.c:403
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "確定"
|
||||
|
||||
#: buttons.c:411
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "取消"
|
||||
|
||||
#: buttons.c:419
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "離開"
|
||||
|
||||
#: buttons.c:427
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "其他"
|
||||
|
||||
#: buttons.c:435
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "求助"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:298
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "月"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:318
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "年"
|
||||
|
||||
#: dialog.c:756
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "更名"
|
||||
|
||||
#: fselect.c:571
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "目錄"
|
||||
|
||||
#: fselect.c:572
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "檔案"
|
||||
|
||||
@ -107,6 +107,6 @@ msgstr "不明"
|
||||
msgid "Overall Progress"
|
||||
msgstr "整體進度"
|
||||
|
||||
#: textbox.c:468
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "搜尋"
|
||||
|
12
prgbox.c
12
prgbox.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: prgbox.c,v 1.8 2011/10/20 23:42:32 tom Exp $
|
||||
* $Id: prgbox.c,v 1.9 2012/12/02 23:40:30 tom Exp $
|
||||
*
|
||||
* prgbox.c -- implements the prg box
|
||||
*
|
||||
* Copyright 2011 Thomas E. Dickey
|
||||
* Copyright 2011,2012 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
|
||||
@ -23,6 +23,12 @@
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
static void
|
||||
reapchild(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a pipe which ties stderr and stdout together.
|
||||
*/
|
||||
@ -96,6 +102,7 @@ dialog_prgbox(const char *title,
|
||||
{
|
||||
int code;
|
||||
FILE *fp;
|
||||
void (*oldreaper) (int) = signal(SIGCHLD, reapchild);
|
||||
|
||||
fp = dlg_popen(command, "r");
|
||||
if (fp == NULL)
|
||||
@ -104,6 +111,7 @@ dialog_prgbox(const char *title,
|
||||
code = dlg_progressbox(title, cprompt, height, width, pauseopt, fp);
|
||||
|
||||
pclose(fp);
|
||||
signal(SIGCHLD, oldreaper);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* $Id: progressbox.c,v 1.21 2012/07/03 00:12:52 tom Exp $
|
||||
* $Id: progressbox.c,v 1.23 2012/12/21 10:00:05 tom Exp $
|
||||
*
|
||||
* progressbox.c -- implements the progress box
|
||||
*
|
||||
* Copyright 2005 Valery Reznic
|
||||
* Copyright 2006-2011 Thomas E. Dickey
|
||||
* Copyright 2006-2012 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
|
||||
@ -46,7 +46,7 @@ get_line(MY_OBJ * obj)
|
||||
int col = 0;
|
||||
int j, tmpint, ch;
|
||||
|
||||
while (1) {
|
||||
for (;;) {
|
||||
if ((ch = getc(fp)) == EOF) {
|
||||
obj->is_eof = 1;
|
||||
if (col) {
|
||||
@ -59,20 +59,23 @@ get_line(MY_OBJ * obj)
|
||||
break;
|
||||
if (ch == '\r')
|
||||
break;
|
||||
if (col >= MAX_LEN)
|
||||
continue;
|
||||
if ((ch == TAB) && (dialog_vars.tab_correct)) {
|
||||
tmpint = dialog_state.tab_len
|
||||
- (col % dialog_state.tab_len);
|
||||
for (j = 0; j < tmpint; j++) {
|
||||
if (col < MAX_LEN)
|
||||
if (col < MAX_LEN) {
|
||||
obj->line[col] = ' ';
|
||||
++col;
|
||||
++col;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
obj->line[col] = (char) ch;
|
||||
++col;
|
||||
}
|
||||
if (col >= MAX_LEN)
|
||||
break;
|
||||
}
|
||||
|
||||
obj->line[col] = '\0';
|
||||
|
419
rangebox.c
Normal file
419
rangebox.c
Normal file
@ -0,0 +1,419 @@
|
||||
/*
|
||||
* $Id: rangebox.c,v 1.17 2013/03/17 16:02:00 tom Exp $
|
||||
*
|
||||
* rangebox.c -- implements the rangebox dialog
|
||||
*
|
||||
* Copyright 2012,2013 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>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#define ONE_HIGH 1
|
||||
|
||||
#define MIN_HIGH (ONE_HIGH + 1 + (4 * MARGIN))
|
||||
#define MIN_WIDE (10 + 2 + (2 * MARGIN))
|
||||
|
||||
struct _box;
|
||||
|
||||
typedef struct _box {
|
||||
WINDOW *parent;
|
||||
WINDOW *window;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
int period;
|
||||
int value;
|
||||
} BOX;
|
||||
|
||||
typedef struct {
|
||||
/* window in which the value and slider are drawn */
|
||||
WINDOW *window;
|
||||
int min_value;
|
||||
int max_value;
|
||||
/* position and width of the numeric field */
|
||||
int value_x;
|
||||
int value_len;
|
||||
int value_col;
|
||||
/* position and width of the slider field */
|
||||
int slide_x;
|
||||
int slide_y;
|
||||
int slide_len;
|
||||
/* current value drawn */
|
||||
int current;
|
||||
/* value to add to make slider move by one cell */
|
||||
int slide_inc;
|
||||
} VALUE;
|
||||
|
||||
static int
|
||||
digits_of(int value)
|
||||
{
|
||||
char temp[80];
|
||||
sprintf(temp, "%d", value);
|
||||
return (int) strlen(temp);
|
||||
}
|
||||
|
||||
static int
|
||||
digit_of(VALUE * data)
|
||||
{
|
||||
int col = data->value_col;
|
||||
int result = 1;
|
||||
|
||||
while (++col < data->value_len) {
|
||||
result *= 10;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool
|
||||
set_digit(VALUE * data, int chr)
|
||||
{
|
||||
bool result = FALSE;
|
||||
char buffer[80];
|
||||
long check;
|
||||
char *next = 0;
|
||||
|
||||
sprintf(buffer, "%*d", data->value_len, data->current);
|
||||
buffer[data->value_col] = (char) chr;
|
||||
check = strtol(buffer, &next, 10);
|
||||
if (next == 0 || *next == '\0') {
|
||||
if ((check <= (long) data->max_value) &&
|
||||
(check >= (long) data->min_value)) {
|
||||
result = TRUE;
|
||||
data->current = (int) check;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is similar to the gauge code, but differs in the way the number
|
||||
* is displayed, etc.
|
||||
*/
|
||||
static void
|
||||
draw_value(VALUE * data, int value)
|
||||
{
|
||||
if (value != data->current) {
|
||||
WINDOW *win = data->window;
|
||||
int y, x;
|
||||
int n;
|
||||
int ranges = (data->max_value + 1 - data->min_value);
|
||||
int offset = (value - data->min_value);
|
||||
int scaled;
|
||||
|
||||
getyx(win, y, x);
|
||||
|
||||
if (ranges > data->slide_len) {
|
||||
scaled = (offset + data->slide_inc) / data->slide_inc;
|
||||
} else if (ranges < data->slide_len) {
|
||||
scaled = (offset + 1) * data->slide_inc;
|
||||
} else {
|
||||
scaled = offset;
|
||||
}
|
||||
|
||||
(void) wattrset(win, gauge_attr);
|
||||
wmove(win, data->slide_y, data->slide_x);
|
||||
for (n = 0; n < data->slide_len; ++n) {
|
||||
(void) waddch(win, ' ');
|
||||
}
|
||||
wmove(win, data->slide_y, data->value_x);
|
||||
wprintw(win, "%*d", data->value_len, value);
|
||||
if ((gauge_attr & A_REVERSE) != 0) {
|
||||
wattroff(win, A_REVERSE);
|
||||
} else {
|
||||
(void) wattrset(win, A_REVERSE);
|
||||
}
|
||||
wmove(win, data->slide_y, data->slide_x);
|
||||
for (n = 0; n < scaled; ++n) {
|
||||
chtype ch2 = winch(win);
|
||||
if (gauge_attr & A_REVERSE) {
|
||||
ch2 &= ~A_REVERSE;
|
||||
}
|
||||
(void) waddch(win, ch2);
|
||||
}
|
||||
(void) wattrset(win, dialog_attr);
|
||||
|
||||
wmove(win, y, x);
|
||||
data->current = value;
|
||||
|
||||
dlg_trace_msg("drew %d offset %d scaled %d limit %d inc %d\n",
|
||||
value,
|
||||
offset,
|
||||
scaled,
|
||||
data->slide_len,
|
||||
data->slide_inc);
|
||||
|
||||
dlg_trace_win(win);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow the user to select from a range of values, e.g., using a slider.
|
||||
*/
|
||||
int
|
||||
dialog_rangebox(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int min_value,
|
||||
int max_value,
|
||||
int default_value)
|
||||
{
|
||||
/* *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_NEXT, CHR_NEXT ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, CHR_BACKSPACE ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, CHR_PREVIOUS ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_FIRST, KEY_HOME),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_LAST, KEY_END),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_LAST, KEY_LL ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, '+'),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_DOWN),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, '-' ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, KEY_UP ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NEXT),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PREVIOUS ),
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
VALUE data;
|
||||
int key = 0, key2, fkey;
|
||||
int button;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
WINDOW *dialog;
|
||||
int state = dlg_default_button();
|
||||
const char **buttons = dlg_ok_labels();
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
char buffer[MAX_LEN];
|
||||
int cur_value = default_value;
|
||||
int usable;
|
||||
int ranges;
|
||||
int yorg, xorg;
|
||||
|
||||
if (max_value < min_value)
|
||||
max_value = min_value;
|
||||
if (cur_value > max_value)
|
||||
cur_value = max_value;
|
||||
if (cur_value < min_value)
|
||||
cur_value = min_value;
|
||||
|
||||
dlg_does_output();
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
|
||||
dlg_auto_size(title, prompt, &height, &width, 0, 0);
|
||||
height += MIN_HIGH;
|
||||
if (width < MIN_WIDE)
|
||||
width = MIN_WIDE;
|
||||
dlg_button_layout(buttons, &width);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
dialog = dlg_new_window(height, width,
|
||||
yorg = dlg_box_y_ordinate(height),
|
||||
xorg = dlg_box_x_ordinate(width));
|
||||
|
||||
data.window = dialog;
|
||||
|
||||
data.min_value = min_value;
|
||||
data.max_value = max_value;
|
||||
|
||||
usable = (width - 2 - 4 * MARGIN);
|
||||
ranges = max_value - min_value + 1;
|
||||
|
||||
/*
|
||||
* Center the number after allowing for its maximum number of digits.
|
||||
*/
|
||||
data.value_len = digits_of(max_value);
|
||||
if (digits_of(min_value) > data.value_len)
|
||||
data.value_len = digits_of(min_value);
|
||||
data.value_x = (usable - data.value_len) / 2 + MARGIN;
|
||||
data.value_col = data.value_len - 1;
|
||||
|
||||
/*
|
||||
* The slider is scaled, to try to use the width of the dialog.
|
||||
*/
|
||||
if (ranges > usable) {
|
||||
data.slide_inc = (ranges + usable - 1) / usable;
|
||||
data.slide_len = 1 + ranges / data.slide_inc;
|
||||
} else if (ranges < usable) {
|
||||
data.slide_inc = usable / ranges;
|
||||
data.slide_len = ranges * data.slide_inc;
|
||||
} else {
|
||||
data.slide_inc = 1;
|
||||
data.slide_len = usable;
|
||||
}
|
||||
data.slide_x = (usable - data.slide_len) / 2 + MARGIN + 2;
|
||||
data.slide_y = height - 5;
|
||||
|
||||
data.current = cur_value - 1;
|
||||
|
||||
dlg_register_window(dialog, "rangebox", binding);
|
||||
dlg_register_buttons(dialog, "rangebox", buttons);
|
||||
|
||||
dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr);
|
||||
dlg_mouse_setbase(xorg, yorg);
|
||||
dlg_mouse_mkregion(data.slide_y - 1, data.slide_x - 1, 3, usable + 2, 'i');
|
||||
dlg_draw_box2(dialog,
|
||||
height - 6, data.slide_x - MARGIN,
|
||||
2 + MARGIN, data.slide_len + 2 * MARGIN,
|
||||
dialog_attr,
|
||||
border_attr,
|
||||
border2_attr);
|
||||
dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr);
|
||||
dlg_draw_title(dialog, title);
|
||||
dlg_draw_helpline(dialog, FALSE);
|
||||
|
||||
(void) wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
dlg_trace_win(dialog);
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
draw_value(&data, cur_value);
|
||||
button = (state < 0) ? 0 : state;
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
if (state < 0) {
|
||||
data.value_col = data.value_len + state;
|
||||
wmove(dialog, data.slide_y, data.value_x + data.value_col);
|
||||
}
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
|
||||
if ((key2 = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
result = key2;
|
||||
} else {
|
||||
/* handle function-keys */
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case DLGK_ENTER:
|
||||
result = dlg_ok_buttoncode(button);
|
||||
break;
|
||||
case DLGK_FIELD_PREV:
|
||||
if (state < 0 && state > -data.value_len) {
|
||||
--state;
|
||||
} else {
|
||||
state = dlg_prev_ok_buttonindex(state, -data.value_len);
|
||||
}
|
||||
break;
|
||||
case DLGK_FIELD_NEXT:
|
||||
if (state < 0) {
|
||||
++state;
|
||||
} else {
|
||||
state = dlg_next_ok_buttonindex(state, -data.value_len);
|
||||
}
|
||||
break;
|
||||
case DLGK_ITEM_FIRST:
|
||||
cur_value = min_value;
|
||||
break;
|
||||
case DLGK_ITEM_LAST:
|
||||
cur_value = max_value;
|
||||
break;
|
||||
case DLGK_ITEM_PREV:
|
||||
if (state < 0) {
|
||||
cur_value -= digit_of(&data);
|
||||
} else {
|
||||
cur_value -= 1;
|
||||
}
|
||||
if (cur_value < min_value)
|
||||
cur_value = min_value;
|
||||
break;
|
||||
case DLGK_ITEM_NEXT:
|
||||
if (state < 0) {
|
||||
cur_value += digit_of(&data);
|
||||
} else {
|
||||
cur_value += 1;
|
||||
}
|
||||
if (cur_value > max_value)
|
||||
cur_value = max_value;
|
||||
break;
|
||||
case DLGK_PAGE_PREV:
|
||||
cur_value -= data.slide_inc;
|
||||
if (cur_value < min_value)
|
||||
cur_value = min_value;
|
||||
break;
|
||||
case DLGK_PAGE_NEXT:
|
||||
cur_value += data.slide_inc;
|
||||
if (cur_value > max_value)
|
||||
cur_value = max_value;
|
||||
break;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
case DLGK_MOUSE('i'):
|
||||
state = -data.value_len;
|
||||
break;
|
||||
default:
|
||||
if (is_DLGK_MOUSE(key)) {
|
||||
result = dlg_ok_buttoncode(key - M_EVENT);
|
||||
if (result < 0)
|
||||
result = DLG_EXIT_OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (isdigit(key) && state < 0) {
|
||||
if (set_digit(&data, key)) {
|
||||
cur_value = data.current;
|
||||
data.current--;
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(buffer, "%d", cur_value);
|
||||
dlg_add_result(buffer);
|
||||
dlg_add_separator();
|
||||
dlg_add_last_key(-1);
|
||||
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free(prompt);
|
||||
|
||||
return result;
|
||||
}
|
15
rc.c
15
rc.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: rc.c,v 1.49 2011/10/15 00:56:44 tom Exp $
|
||||
* $Id: rc.c,v 1.51 2012/11/30 21:32:39 tom Exp $
|
||||
*
|
||||
* rc.c -- routines for processing the configuration file
|
||||
*
|
||||
* Copyright 2000-2010,2011 Thomas E. Dickey
|
||||
* Copyright 2000-2011,2012 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
|
||||
@ -214,6 +214,7 @@ str_to_attr(char *str, int *fg, int *bg, int *hl)
|
||||
int i = 0, get_fg = 1;
|
||||
unsigned j;
|
||||
char tempstr[MAX_LEN + 1], *part;
|
||||
size_t have;
|
||||
|
||||
if (str[0] != '(' || lastch(str) != ')') {
|
||||
if ((i = find_color(str)) >= 0) {
|
||||
@ -226,8 +227,14 @@ str_to_attr(char *str, int *fg, int *bg, int *hl)
|
||||
}
|
||||
|
||||
/* remove the parenthesis */
|
||||
strcpy(tempstr, str + 1);
|
||||
lastch(tempstr) = '\0';
|
||||
have = strlen(str);
|
||||
if (have > MAX_LEN) {
|
||||
have = MAX_LEN - 1;
|
||||
} else {
|
||||
have -= 2;
|
||||
}
|
||||
memcpy(tempstr, str + 1, have);
|
||||
tempstr[have] = '\0';
|
||||
|
||||
/* get foreground and background */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
# $Id: rename.sh,v 1.3 2011/01/06 10:51:02 tom Exp $
|
||||
# $Id: rename.sh,v 1.4 2012/12/19 10:17:36 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 2011 Thomas E. Dickey #
|
||||
# Copyright (c) 2011,2012 Thomas E. Dickey #
|
||||
# #
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a #
|
||||
# copy of this software and associated documentation files (the "Software"), #
|
||||
@ -54,6 +54,7 @@ sed -e "s,^\.ds p dialog\>,.ds p $BINARY," \
|
||||
-e "s,^\.ds l dialog\>,.ds l $PACKAGE," \
|
||||
-e "s,^\.ds L Dialog\>,.ds L $ONE_CAPS," \
|
||||
-e "s,^\.ds D DIALOG\>,.ds D $ALL_CAPS," \
|
||||
-e 's,^dialog \\- ,'"$PACKAGE"' \\- ,' \
|
||||
<$SOURCE >source.tmp
|
||||
"$@" source.tmp $TARGET
|
||||
rm -f source.tmp
|
||||
|
@ -1,40 +1,7 @@
|
||||
-- $Id: README,v 1.3 2007/01/11 22:52:19 tom Exp $
|
||||
-- $Id: README,v 1.4 2012/12/02 18:52:52 tom Exp $
|
||||
|
||||
You can set the environment-variable DIALOG to whatever program you
|
||||
want to check. Default is "dialog".
|
||||
|
||||
Use "export DIALOG=/usr/bin/dialog" for sh or "setenv DIALOG ../dialog" for csh
|
||||
to test the /usr/bin/dialog program.
|
||||
|
||||
-- Here is the original README for the samples directory.
|
||||
|
||||
There is no documentation at the moment for cdialog 0.9a, but here are a
|
||||
small installer (copismall) for 'points' fido-like, that uses cdialog 0.9a.
|
||||
It can demonstrate some of the new features... run "copismall" paying
|
||||
attention because after asking for some things, it then installs and/or
|
||||
configures programs like as Inn, Ifmail, Smail to make the 'point'.
|
||||
It's in Italian language only at moment, but the code is bash......
|
||||
If you want look at other much professional products FREE realized with
|
||||
cdialog and that use much of the other new characteristics, look for one of
|
||||
the ComeOn Point Suites v1.1+. Makers are a sub-group of the ComeOn Linux
|
||||
Development Team... ComeOn Linux! follows GNU philosophy.
|
||||
|
||||
Mail demarco_p@abramo.it to have the actual location of these Suites and
|
||||
of other free ComeOn Linux! software, or if you want more info about
|
||||
ComeOn Linux!
|
||||
|
||||
To run the "ComeOn Point Installer! v0.9a.small", type:
|
||||
$ copismall
|
||||
|
||||
Other external samples could be:
|
||||
|
||||
copa - ComeOn Point Administrator! v0.8
|
||||
copm - ComeOn Point Maintainer! v0.2
|
||||
copi - ComeOn Point Installer! v0.9 (system-wide version of copi)
|
||||
coepi - ComeOn Expert Point Installer! v1.3 (Professional)
|
||||
|
||||
cops - ComeOn Point Suite! v1.1
|
||||
copsp - ComeOn Point Suite Professional! v1.1
|
||||
|
||||
coui - ComeOn UUCP Installer! v0.1 (makes dialup networks in a moment)
|
||||
|
||||
|
20
samples/buildlist
Executable file
20
samples/buildlist
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# $Id: buildlist,v 1.2 2012/12/04 11:45:21 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
. ./setup-tempfile
|
||||
|
||||
$DIALOG --title "BUILDLIST DEMO" --backtitle "A user-built list" \
|
||||
--separator "|" \
|
||||
--buildlist "hello, this is a --buildlist..." 0 0 0 \
|
||||
"1" "Item number 1" "on" \
|
||||
"2" "Item number 2" "off" \
|
||||
"3" "Item number 3" "on" \
|
||||
"4" "Item number 4" "on" \
|
||||
"5" "Item number 5" "off" \
|
||||
"6" "Item number 6" "on" 2> $tempfile
|
||||
|
||||
retval=$?
|
||||
|
||||
. ./report-tempfile
|
42
samples/buildlist2
Executable file
42
samples/buildlist2
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# $Id: buildlist2,v 1.6 2012/12/23 22:28:12 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
. ./setup-edit
|
||||
|
||||
count=0
|
||||
ls -1 | while true
|
||||
do
|
||||
read filename
|
||||
test -z "$filename" && break
|
||||
case $filename in
|
||||
*.*)
|
||||
state=off
|
||||
;;
|
||||
*-*)
|
||||
state=on
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
case "x$DIALOGOPTS" in
|
||||
*--no-items*|*--noitem*)
|
||||
echo $filename $state >>$input
|
||||
;;
|
||||
*)
|
||||
echo $count $filename $state >>$input
|
||||
;;
|
||||
esac
|
||||
count=`expr $count + 1`
|
||||
done
|
||||
|
||||
$DIALOG --title "BUILDLIST DEMO" --backtitle "A user-built list" \
|
||||
--visit-items --scrollbar --separator "|" \
|
||||
--buildlist "hello, this is a --buildlist..." 0 0 10 `cat $input` 2> $output
|
||||
|
||||
retval=$?
|
||||
|
||||
tempfile=$output
|
||||
. ./report-tempfile
|
44
samples/checklist12
Executable file
44
samples/checklist12
Executable file
@ -0,0 +1,44 @@
|
||||
#! /bin/sh
|
||||
# $Id: checklist12,v 1.3 2012/12/23 22:27:51 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
. ./setup-edit
|
||||
|
||||
case "x$DIALOGOPTS" in
|
||||
*--no-items*|*--noitem*)
|
||||
CUT="cut -d: -f1,3"
|
||||
;;
|
||||
*)
|
||||
CUT="cat"
|
||||
;;
|
||||
esac
|
||||
|
||||
$CUT >$input <<-EOF
|
||||
Apple:It's an apple.:off
|
||||
Dog:No, that's not my dog.:ON
|
||||
Orange:Yeah, that's juicy.:off
|
||||
Chicken:Normally not a pet.:off
|
||||
Cat:No, never put a dog and a cat together!:oN
|
||||
Fish:Cats like fish.:On
|
||||
Lemon:You know how it tastes.:on
|
||||
EOF
|
||||
cat $input | sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' >$output
|
||||
cat $output >$input
|
||||
|
||||
$DIALOG --backtitle "No Such Organization" \
|
||||
--title "CHECKLIST BOX" "$@" \
|
||||
--checklist "Hi, this is a checklist box. You can use this to \n\
|
||||
present a list of choices which can be turned on or \n\
|
||||
off. If there are more items than can fit on the \n\
|
||||
screen, the list will be scrolled. You can use the \n\
|
||||
UP/DOWN arrow keys, the first letter of the choice as a \n\
|
||||
hot key, or the number keys 1-9 to choose an option. \n\
|
||||
Press SPACE to toggle an option on/off. \n\n\
|
||||
Which of the following are fruits?" 20 61 5 \
|
||||
--file $input 2> $output
|
||||
|
||||
retval=$?
|
||||
|
||||
tempfile=$output
|
||||
. ./report-tempfile
|
@ -1,200 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id: admin.funcs,v 1.3 2012/02/16 01:29:39 tom Exp $
|
||||
#
|
||||
# ComeOn Point Functions! v0.9.2
|
||||
# - usate da vari altri moduli ComeOn Point...
|
||||
#
|
||||
# AUTHOR: Beppe (beppe.dem@nsm.it)
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
|
||||
# Args: source_file, domain, nldir
|
||||
install_nodelist() {
|
||||
|
||||
NODELIST="$1"
|
||||
FOR_DOMAIN="$2"
|
||||
NODEDIR="$3"
|
||||
|
||||
dialog --backtitle "$TITLE" --infobox "Installo la nodelist '$NODELIST' per il domain $FOR_DOMAIN, attendere prego..." 0 0
|
||||
|
||||
cp "$NODELIST" $NODEDIR/$FOR_DOMAIN.ndl
|
||||
chown fnet.uucp $NODEDIR/$FOR_DOMAIN.ndl
|
||||
|
||||
echo "y" | su -l fnet -c "ifindex" >/dev/null
|
||||
}
|
||||
|
||||
# Args: source, dest
|
||||
add_alias() {
|
||||
|
||||
SOURCE=$1
|
||||
DEST=$2
|
||||
ALIASES=/etc/aliases
|
||||
ENTRY="`grep $SOURCE: $ALIASES`"
|
||||
|
||||
dialog --backtitle "$TITLE" --infobox "Creo un alias per redirigere le mail per $SOURCE a $DEST ..." 0 0
|
||||
|
||||
if [ ! "$ENTRY" ]
|
||||
then
|
||||
echo "$SOURCE: $DEST" >>$ALIASES
|
||||
else
|
||||
OLDDEST="`echo $ENTRY | cut -f2 -d:`"
|
||||
mkstemp alias
|
||||
sed /"$SOURCE:"/s/"$OLDDEST"/" $DEST"/ $ALIASES >$tmp_alias
|
||||
cat $tmp_alias >$ALIASES
|
||||
rm $tmp_alias
|
||||
fi
|
||||
mkaliases >/dev/null
|
||||
}
|
||||
|
||||
# Args: Areas_pathname, newsgroup, area_ftn, description [, expire_days]
|
||||
# Returns: 1 - innd not running
|
||||
# 2 - already existing newsgroup
|
||||
# 3 - already existing ftn_area
|
||||
create_newsgroup() {
|
||||
|
||||
AREAS="$1"
|
||||
NEWSGROUP="$2"
|
||||
AREA="$3"
|
||||
DESCRIPTION="$4"
|
||||
EXPIRE_DAYS="$5"
|
||||
|
||||
NEWSGROUPS=~news/newsgroups
|
||||
EXPIRECTL=~news/expire.ctl
|
||||
|
||||
dialog --backtitle "$TITLE" --infobox "Creo il newsgroup $NEWSGROUP per contenere i messaggi dell'area $AREA..." 0 0
|
||||
|
||||
if [ ! "`ps ax | grep ~news/etc/innd`" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "`cut $NEWSGROUPS -f1 | cut -f1 -d\ | grep -x $NEWSGROUP`" ]
|
||||
then
|
||||
return 2
|
||||
fi
|
||||
|
||||
if [ "`cut $AREAS -f1 | cut -f1 -d\ | grep -x $AREA`" ]
|
||||
then
|
||||
return 3
|
||||
fi
|
||||
|
||||
su -l news -c "bin/ctlinnd newgroup $NEWSGROUP" >/dev/null
|
||||
echo -e "$NEWSGROUP\t$DESCRIPTION" >> $NEWSGROUPS
|
||||
echo -e "$AREA\t$NEWSGROUP\t`echo $NEWSGROUP | cut -f1 -d.`" >> $AREAS
|
||||
|
||||
if [ "$EXPIRE_DAYS" ]; then
|
||||
echo "$NEWSGROUP:A:2:$EXPIRE_DAYS:$EXPIRE_DAYS" >> $EXPIRECTL
|
||||
fi
|
||||
|
||||
chown news.news $NEWSGROUPS $EXPIRECTL
|
||||
chmod 440 $EXPIRECTL
|
||||
chown fnet.uucp $AREAS
|
||||
}
|
||||
|
||||
# Returns: 0 if ok, 1 if (innd not running), 2 if (no that newsgroup)
|
||||
# Args: Areas_pathname, newsgroup
|
||||
rmgroup() {
|
||||
|
||||
AREAS=$1
|
||||
NEWSGR=$2
|
||||
NEWSGROUPS=~news/newsgroups
|
||||
EXPIRE=~news/expire.ctl
|
||||
|
||||
dialog --backtitle "$TITLE" --infobox "Elimino il newsgroup $NEWSGR ed i messaggi in esso contenuti, attendere prego. Questa operazione potrebbe durare alcuni minuti." 0 0
|
||||
|
||||
if [ ! "`ps x | grep ~news/etc/innd`" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! "`cut -f1 $NEWSGROUPS | cut -f1 -d\ | grep -x $NEWSGR`" ]
|
||||
then
|
||||
return 2
|
||||
else
|
||||
|
||||
# Updating newsgroups file
|
||||
if [ -f $NEWSGROUPS ]
|
||||
then
|
||||
mkstemp groups
|
||||
mv $NEWSGROUPS $NEWSGROUPS~
|
||||
grep -v $NEWSGR $NEWSGROUPS~ >$tmp_groups
|
||||
mv $tmp_groups $NEWSGROUPS
|
||||
else
|
||||
:> $NEWSGROUPS
|
||||
fi
|
||||
chown news.news $NEWSGROUPS
|
||||
|
||||
# Updating Areas file
|
||||
if [ -f $AREAS ]
|
||||
then
|
||||
mkstemp areas
|
||||
mv $AREAS $AREAS~
|
||||
grep -v $NEWSGR $AREAS~ >$tmp_areas
|
||||
mv $tmp_areas $AREAS
|
||||
else
|
||||
:> $AREAS
|
||||
fi
|
||||
chown fnet.uucp $AREAS
|
||||
|
||||
# Updating expire.ctl file
|
||||
if [ -f $EXPIRE ]
|
||||
then
|
||||
mkstemp expire
|
||||
mv $EXPIRE $EXPIRE~
|
||||
grep -v "$NEWSGR:" $EXPIRE~ >$tmp_expire
|
||||
mv $tmp_expire $EXPIRE
|
||||
else
|
||||
:> $EXPIRE
|
||||
fi
|
||||
chown news.news $EXPIRE
|
||||
chmod 444 $EXPIRE
|
||||
# Remove pending articles
|
||||
echo -e "\n$NEWSGR:A:0:0:0" >>$EXPIRE
|
||||
su -l news -c "bin/news.daily" >/dev/null
|
||||
mkstemp expire
|
||||
grep -v $NEWSGR $EXPIRE >$tmp_expire
|
||||
mv $tmp_expire $EXPIRE
|
||||
chown news.news $EXPIRE
|
||||
chmod 444 $EXPIRE
|
||||
|
||||
# Updating active file
|
||||
su -l news -c "bin/ctlinnd rmgroup $NEWSGR" >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
# Args: newsgroups_wildmat, days_to_keep
|
||||
set_expire_time() {
|
||||
|
||||
NEWSGROUP="$1"
|
||||
KEEPDAYS="$2"
|
||||
EXPIRE=~news/expire.ctl
|
||||
|
||||
dialog --backtitle "$TITLE" --infobox "Imposto a $KEEPDAYS il numero di giorni di mantenimento dei messaggi del newsgroup $NEWSGROUP..." 0 0
|
||||
|
||||
if [ ! -f $EXPIRE ]
|
||||
then
|
||||
:> $EXPIRE
|
||||
|
||||
elif [ "`cut $EXPIRE -s -f1 -d: | grep -x $NEWSGROUP`" ]
|
||||
then
|
||||
mkstemp expire
|
||||
grep -v "$NEWSGROUP:" $EXPIRE >$tmp_expire
|
||||
mv $tmp_expire $EXPIRE
|
||||
fi
|
||||
echo -e "\n$NEWSGROUP:A:2:$KEEPDAYS:$KEEPDAYS" >>$EXPIRE
|
||||
chown news.news $EXPIRE
|
||||
chmod 444 $EXPIRE
|
||||
}
|
@ -1,340 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id: common.funcs,v 1.2 2012/06/29 22:33:42 tom Exp $
|
||||
#
|
||||
# ComeOn Point Functions! v0.9.2
|
||||
# - usate da vari altri moduli ComeOn Point...
|
||||
#
|
||||
# AUTHOR: Beppe (beppe.dem@nsm.it)
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
|
||||
save() {
|
||||
if [ -f $1 ]
|
||||
then
|
||||
mv $1 $1~
|
||||
fi
|
||||
}
|
||||
|
||||
# Returns $PKG_TO_REMOVE
|
||||
find_incompatible_packages() {
|
||||
dialog --backtitle "$TITLE" --infobox "Vediamo innanzitutto se c'e' qualche pacchetto di troppo ... ;-)" 0 0
|
||||
|
||||
PKG_TO_REMOVE=""
|
||||
for i in sendmail smailcfg cnews
|
||||
do
|
||||
if [ -f /var/adm/packages/$i ]
|
||||
then
|
||||
PKG_TO_REMOVE="$PKG_TO_REMOVE $i"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Returns $PKG_TO_INSTALL
|
||||
find_necessary_packages() {
|
||||
dialog --backtitle "$TITLE" --infobox "Controlliamo se manca qualche pacchetto..." 0 0
|
||||
|
||||
PKG_TO_INSTALL=""
|
||||
for i in tcpip mailx inn
|
||||
do
|
||||
if [ ! -f /var/adm/packages/$i ]
|
||||
then
|
||||
PKG_TO_INSTALL="$PKG_TO_INSTALL $i"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Args: user, editor
|
||||
configure_trn() {
|
||||
dialog --backtitle "$TITLE" --infobox "Configuro trn all'user $1..." 0 0
|
||||
|
||||
SHELL_USED="`basename \`cut /etc/passwd -f1,7 -d: | grep $1: | cut -f2 -d:\``"
|
||||
USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $1: | cut -f2 -d:`"
|
||||
TRNRC="$USER_HOME/.trnrc"
|
||||
|
||||
case $SHELL_USED in
|
||||
bash)
|
||||
if [ -f $USER_HOME/.bash_profile ]
|
||||
then
|
||||
PROF=$USER_HOME/.bash_profile
|
||||
else
|
||||
PROF=$USER_HOME/.profile
|
||||
fi;;
|
||||
zsh)
|
||||
PROF=$USER_HOME/.zprofile;;
|
||||
*)
|
||||
PROF=$USER_HOME/.profile;;
|
||||
esac
|
||||
|
||||
if [ ! -f $PROF ]
|
||||
then
|
||||
:>$PROF
|
||||
chown $1.mail $PROF
|
||||
elif [ ! "`grep -x \". ~/.trnrc\" $PROF`" ]
|
||||
then
|
||||
echo -e "\n. ~/.trnrc" >>$PROF
|
||||
fi
|
||||
|
||||
save $TRNRC
|
||||
|
||||
echo "EDITOR=\"$2\"" > $TRNRC
|
||||
cat copi.trnrc >> $TRNRC
|
||||
chown $1.mail $TRNRC
|
||||
}
|
||||
|
||||
# Args: user, editor
|
||||
configure_elm() {
|
||||
USER=$1
|
||||
EDIT=$2
|
||||
|
||||
dialog --backtitle "$TITLE" --infobox "Configuro elm all'user $USER..." 0 0
|
||||
|
||||
USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $USER: | cut -f2 -d:`"
|
||||
DIRRC="$USER_HOME/.elm"
|
||||
ELMRC="$DIRRC/elmrc"
|
||||
|
||||
mkdir -p $DIRRC -m 700
|
||||
chown $USER.mail $USERHOME $DIRRC
|
||||
|
||||
save $ELMRC
|
||||
|
||||
cat <<EOF >$ELMRC
|
||||
#
|
||||
# .elm/elmrc - options file for the ELM mail system
|
||||
#
|
||||
# Generated by $PKTNAME for $USER
|
||||
#
|
||||
|
||||
# For yes/no settings with ?, ON means yes, OFF means no
|
||||
|
||||
# how to sort the alias list, "Name" by default
|
||||
### aliassortby = Name
|
||||
|
||||
# name of editor to use for replies that have text
|
||||
alteditor = $EDIT
|
||||
|
||||
# alternative addresses that I could receive mail from (usually a
|
||||
# forwarding mailbox) and don't want to have listed...
|
||||
### alternatives =
|
||||
|
||||
# should the default be to delete messages we've marked for deletion?
|
||||
alwaysdelete = ON
|
||||
|
||||
# should the default be to keep unread messages in the incoming mailbox?
|
||||
alwayskeep = ON
|
||||
|
||||
# should the default be to store read messages to the "received" folder?
|
||||
alwaysstore = OFF
|
||||
|
||||
# should we use the "->" rather than the inverse video bar?
|
||||
arrow = OFF
|
||||
|
||||
# should the message disposition questions be displayed(ON) or
|
||||
# auto-answered(OFF) with the default answers when we resync or
|
||||
# change folders?
|
||||
ask = OFF
|
||||
|
||||
# would you like to be asked for Carbon-Copies information each msg?
|
||||
askcc = OFF
|
||||
|
||||
# attribution string for replies ('%s' is the author of original message)
|
||||
attribution = %s wrote:
|
||||
|
||||
# automatically copy message being replied to into buffer?
|
||||
autocopy = ON
|
||||
|
||||
# threshold for bouncing copies of remote uucp messages...
|
||||
# zero = disable function.
|
||||
### bounceback = 0
|
||||
|
||||
# This is used to determine if the builtin pager should be used on some
|
||||
# messages even if you would usually use an external pager program.
|
||||
# There are two ways of determining whether the builtin pager should be
|
||||
# used. If you want any message that is shorter than "n" lines to use the
|
||||
# internal pager, set the parameter to "n". If you want the builtin
|
||||
# pager to be used if the message is "m" lines shorter than the number of
|
||||
# lines on your screen set the parameter to be "-m". Setting the
|
||||
# parameter to zero will result in the message always being sent through
|
||||
# your external pager.
|
||||
### builtinlines = -3
|
||||
|
||||
# where to save calendar entries
|
||||
#calendar = /root/calendar
|
||||
|
||||
# list of options that can be configured at the "o)ptions" screen
|
||||
configoptions = ^_cdefsopyv_am_un
|
||||
|
||||
# Should elm always ask the user to confirm before it appends
|
||||
# messages to any existing file?
|
||||
# This is used for both folders in the user's mail directory
|
||||
# and ordinary files.
|
||||
confirmappend = OFF
|
||||
|
||||
# Should elm always ask the user to confirm before it creates
|
||||
# any new files?
|
||||
# This is used for both folders in the user's mail directory
|
||||
# and ordinary files.
|
||||
confirmcreate = OFF
|
||||
|
||||
# Should elm ask for confirmation before it appends a message
|
||||
# to an existing file that is not a folder in the user's Mail
|
||||
# directory?
|
||||
# This is used for ordinary files only and does not affect
|
||||
# folders in the user's mail directory.
|
||||
confirmfiles = OFF
|
||||
|
||||
# Should elm ask for confirmation before it creates a new folder
|
||||
# in the user's Mail directory?
|
||||
# This is used only for folders in the user's mail directory and
|
||||
# does not affect ordinary files.
|
||||
confirmfolders = OFF
|
||||
|
||||
# save a copy of all outbound messages?
|
||||
copy = ON
|
||||
|
||||
# name of editor for ~e command (when editor="builtin")
|
||||
easyeditor = $EDIT
|
||||
|
||||
# what editor to use ("none" means simulate Berkeley Mail)
|
||||
editor = $EDIT
|
||||
|
||||
# the character to use in the builtin editor for entering commands
|
||||
### escape = ~
|
||||
|
||||
# save outbound messages by login name of sender/recipient even if the
|
||||
# associated folder doesn't already exist?
|
||||
### forcename = OFF
|
||||
|
||||
# do we want to be able to mail out AT&T Mail Forms?
|
||||
### forms = OFF
|
||||
|
||||
# The full user name for outbound mail
|
||||
### fullname = $PKTNAME User
|
||||
|
||||
# should we keep folders from which all messages are deleted?
|
||||
### keepempty = OFF
|
||||
|
||||
# are we running on an HP terminal and want HOME, PREV, NEXT, etc...?
|
||||
### keypad = OFF
|
||||
|
||||
# local ".signature" file to append to appropriate messages...
|
||||
localsignature = ~/.signature
|
||||
|
||||
# where to save my mail to, default directory is "Mail"
|
||||
maildir = ~/Mail
|
||||
|
||||
# should we display the three-line 'mini' menu?
|
||||
menu = ON
|
||||
|
||||
# would you like a copy of a message you send to an alias you are on?
|
||||
### metoo = OFF
|
||||
|
||||
# when using the page commands (+ - <NEXT> <PREV>) change the current
|
||||
# message pointer...?
|
||||
### movepage = OFF
|
||||
|
||||
# just show the names when expanding aliases?
|
||||
names = OFF
|
||||
|
||||
# when messages are copied into the outbound buffer, don't include headers?
|
||||
noheader = ON
|
||||
|
||||
# program to use for displaying messages ('builtin' is recommended)
|
||||
### pager = builtin+
|
||||
|
||||
# start up by pointing to the first new message received, if possible?
|
||||
### pointnew = ON
|
||||
|
||||
# list of delivery precedences allowed, or empty to allow anything
|
||||
# precedence may be followed by optional ":priority" specification
|
||||
### precedences =
|
||||
|
||||
# prefix sequence for indenting included message text in outgoing messages...
|
||||
prefix = _:>_
|
||||
|
||||
# how to print a message ('%s' is the filename)
|
||||
### print = /bin/cat %s | /usr/bin/lpr
|
||||
|
||||
# prompt for a command after the external pager exits?
|
||||
### promptafter = ON
|
||||
|
||||
# Value by which message count is incremented while reading a new mailbox.
|
||||
# Setting this value to a number larger than one will speed up the time it
|
||||
# takes to read a large mailbox when using a slow terminal.
|
||||
### readmsginc = 1
|
||||
|
||||
# where to save received messages to, default file is "=received"
|
||||
receivedmail = =received
|
||||
|
||||
# remote ".signature" file to append to appropriate messages...
|
||||
remotesignature = ~/.signature
|
||||
|
||||
# emulate the mailx message increment mode (only increment after
|
||||
# something has been 'done' to a message, either saved or deleted,
|
||||
# as opposed to simply each time something is touched)?
|
||||
### resolve = ON
|
||||
|
||||
# save messages, incoming and outbound, by login name of sender/recipient?
|
||||
savename = ON
|
||||
|
||||
# where to save copies of outgoing mail to, default file is "=sent"
|
||||
sentmail = =sent
|
||||
|
||||
# The shell to use for shell escapes
|
||||
shell = /bin/sh
|
||||
|
||||
# do we want dashes above signatures? (News 2.11 compatibility and convention)
|
||||
### sigdashes = ON
|
||||
|
||||
# time in seconds which Elm will wait after displaying a transient message
|
||||
# and before erasing it. Can be 0 or positive integer.
|
||||
### sleepmsg = 2
|
||||
|
||||
# are we running on an HP terminal and want softkeys available too?
|
||||
# (this implies "keypad=ON" too)
|
||||
### softkeys = OFF
|
||||
|
||||
# how to sort folders, "Reverse Sent" by default
|
||||
### sortby = Reverse-Sent
|
||||
|
||||
# Set the main prompt timeout for resynching...
|
||||
### timeout = 600
|
||||
|
||||
# display message title when displaying pages of message?
|
||||
titles = ON
|
||||
|
||||
# where to place temporary files, default directory is "/tmp"
|
||||
### tmpdir = /tmp/
|
||||
|
||||
# are we good at it? 0=beginner, 1=intermediate, 2+ = expert!
|
||||
userlevel = 0
|
||||
|
||||
# would you like to use termcap/terminfo ti/te entries?
|
||||
usetite = ON
|
||||
|
||||
# name of editor for ~v command (when editor="builtin")
|
||||
visualeditor = $EDIT
|
||||
|
||||
# enable the weedout list to be read?
|
||||
### weed = ON
|
||||
|
||||
# what headers I DON'T want to see, ever.
|
||||
weedout = "*end-of-user-headers*"
|
||||
|
||||
EOF
|
||||
|
||||
chmod 600 $ELMRC
|
||||
chown $USER.mail $ELMRC
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,29 +0,0 @@
|
||||
#! /usr/bin/perl
|
||||
#
|
||||
# This is a utility script to manipulate Fidonet-related issues
|
||||
# using Eugene Crosser's ifmail package
|
||||
#
|
||||
# Version 0.1
|
||||
#
|
||||
# (C) Michael Bravo and The Communication Tube, 1994
|
||||
#
|
||||
# You can do whatever you want with this script. I take no responsibility
|
||||
# whatsoever in anything related to this script. If you make some useful
|
||||
# additions to this, please think of sending them to me so I could partake
|
||||
# of your wisdom.
|
||||
#
|
||||
# This script was written to help attaching and requesting files from the
|
||||
# commandline, much like you do with Squish under DOS or OS/2. It is certainly
|
||||
# not perfect - I used it as an exercise in Perl. It also probably lacks
|
||||
# some other useful features, like ability to specify trunc/sent or kill/sent
|
||||
# attributes etc etc. If you really want this or some other features
|
||||
# implemented, write me at mbravo@tctube.spb.su or mbravo@octopus.spb.su
|
||||
# and I will try to do what I can.
|
||||
#
|
||||
# Note - files don't get copied to any spool dir, so if you move attached
|
||||
# files somewhere, they won't get sent.
|
||||
#
|
||||
# This script is supposed to read ifmail's config to determine where outbound
|
||||
# directory and logfile are. The only two parameters to modify in most cases
|
||||
# are below.
|
||||
|
@ -1,140 +0,0 @@
|
||||
# vile:perlmode
|
||||
# $Id: copi.ifman2,v 1.2 2012/06/29 22:33:42 tom Exp $
|
||||
|
||||
if ( getpwuid($<) ne $ifowner ) { print "You must be owner of ifmail\n"; exit 1; }
|
||||
|
||||
if ( (@ARGV < 3) || $ARGV[0] eq "-?" || $ARGV[0] eq "-h" ) {
|
||||
&usage;
|
||||
}
|
||||
|
||||
$ARGV[0] =~ tr/A-Z/a-z/;
|
||||
$ARGV[3] =~ tr/A-Z/a-z/;
|
||||
|
||||
&parsecfg;
|
||||
|
||||
if ( $logfile ne "" ) {
|
||||
open(LOG, ">>".$logfile) || die "Can't open logfile";
|
||||
}
|
||||
|
||||
if (substr($ARGV[1], 0, 1) ne "/") {
|
||||
$cwd=`pwd`;
|
||||
chop $cwd;
|
||||
$ARGV[1] = $cwd."/".$ARGV[1];
|
||||
}
|
||||
|
||||
if ($ARGV[3] eq "" || $ARGV[3] eq "normal") {
|
||||
$flavour = 'f';
|
||||
} elsif ($ARGV[3] eq "crash") {
|
||||
$flavour = 'c';
|
||||
} elsif ($ARGV[3] eq "hold") {
|
||||
$flavour = 'h';
|
||||
} else {
|
||||
print "Unknown flavour, assuming normal\n";
|
||||
$flavour = 'f';
|
||||
}
|
||||
|
||||
if ($ARGV[0] eq "send") {
|
||||
&attach($ARGV[1], $ARGV[2]);
|
||||
} elsif ($ARGV[0] eq "get") {
|
||||
&request($ARGV[1], $ARGV[2]);
|
||||
} else {
|
||||
print "Unknown command, try ifman -h\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
close(LOG);
|
||||
|
||||
exit 0;
|
||||
|
||||
#######################################################################
|
||||
|
||||
sub attach {
|
||||
local($fspec, $address) = @_;
|
||||
|
||||
$floname = &resolve($address);
|
||||
|
||||
open(FLO, ">>".$outbound."/".$floname) || die "Can't open flo-file $outbound/$floname";
|
||||
open(FIND, "find $fspec -print |") || die "Can't generate list of files";
|
||||
|
||||
if ( eof(FIND) ) {
|
||||
print "No matching files, nothing to send\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
while (<FIND>) {
|
||||
|
||||
chop;
|
||||
$datestamp = `date \"+%D %T\"`;
|
||||
chop $datestamp;
|
||||
printf LOG "%s %s %s\n", $datestamp, $$, "ifman: sending $_ to $address";
|
||||
printf FLO "%s\n", $_;
|
||||
}
|
||||
|
||||
close(FLO);
|
||||
close(FIND);
|
||||
}
|
||||
|
||||
sub request {
|
||||
local($fspec, $address) = @_;
|
||||
|
||||
$reqname = &resolve($address);
|
||||
|
||||
$reqname =~ s/\.[fch]lo/\.req/;
|
||||
|
||||
open(REQ, ">>".$outbound."/".$reqname) || die "Can't open req-file";
|
||||
|
||||
$datestamp = `date \"+%D %T\"`;
|
||||
chop $datestamp;
|
||||
printf LOG "%s %s %s\n", $datestamp, $$, "ifman: requesting $fspec from $address";
|
||||
printf REQ "%s\n", $fspec;
|
||||
|
||||
close(REQ);
|
||||
}
|
||||
|
||||
sub resolve {
|
||||
local($addr) = @_;
|
||||
|
||||
if ( index($addr, ":") >=0 ) {
|
||||
print "I cannot resolve addresses with zones!\n";
|
||||
exit 1;
|
||||
} elsif ( index($addr, "/") == -1 ) {
|
||||
print "Not a valid address!\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
($net, $node, $point) = split(/\/|\./, $addr);
|
||||
|
||||
if ( defined $point ) {
|
||||
$pointdir = sprintf("%04x%04x.pnt", $net, $node);
|
||||
if ( ! -e $outbound."/".$pointdir ) {
|
||||
mkdir ($outbound."/".$pointdir, 0755) || die "Can't create point directory";
|
||||
}
|
||||
$flo = sprintf("0000%04x.%01slo", $point, $flavour);
|
||||
return $pointdir."/".$flo;
|
||||
} else {
|
||||
$flo = sprintf("%04x%04x.%01slo", $net, $node, $flavour);
|
||||
return $flo;
|
||||
}
|
||||
}
|
||||
|
||||
sub usage {
|
||||
print "ifmail manager script\n";
|
||||
print "usage: ifman <cmd> <filespec> <address> [flavour]\n";
|
||||
print " commands: send, get\n";
|
||||
print " flavours: normal, crash, hold. Default is normal.\n";
|
||||
print "Only 2d addresses with points are supported - no zones!\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub parsecfg {
|
||||
open(CFG, $cfgfile) || die "Can't open ifmail config file";
|
||||
|
||||
while (<CFG>) {
|
||||
chop;
|
||||
if (/^#/) { next; }
|
||||
if (/^outbound\s+(\S+)/) { $outbound = $1; }
|
||||
if (/^logfile\s+(\S+)/) { $logfile = $1; }
|
||||
}
|
||||
|
||||
close(CFG);
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
# Transport programs for mail and news, used by iftoss
|
||||
sendmail /usr/lib/sendmail -f $F $T
|
||||
rnews /usr/lib/news/rnews
|
||||
|
||||
# Unpackers, used by ifunpack.
|
||||
# $F expands to archieve file name
|
||||
unzip /usr/bin/unzip -oq $F
|
||||
unarj /usr/bin/unarj e $F
|
||||
#unarc /usr/bin/unpack $F
|
||||
unzoo /usr/bin/zoo -extract $F
|
||||
unlzh /usr/bin/lharc -x $F
|
||||
|
||||
# Packer program, used by ifpack
|
||||
# $F expands to archieve file name, $P - to list of packet names
|
||||
packer /usr/bin/zip $F $P
|
||||
|
||||
# Maximum arcmail file size, will start new arcmail file if exceeds
|
||||
maxfsize 65000
|
||||
|
||||
# Maximum packet size, ifmail/ifnews will start new packet if exeeds.
|
||||
# .out files are NOT created if nonzero specified, you must run ifpack
|
||||
# to make packets out. (unimplemented)
|
||||
maxpsize 65000
|
||||
|
||||
# cnews log file and (temporary) database for seen-bys
|
||||
newslog /usr/lib/news/log
|
||||
msgidbm /tmp/ifmsgids
|
||||
|
||||
# From this line on, values may be prefixed by a logical expression in
|
||||
# round brackets. Operators are: '!', '&', '|', 'Xor'.
|
||||
# Possible elements are:
|
||||
# - Nodelist flags (like "CM", "MNP", "V32" etc.)
|
||||
# - speed <operator> <numeric>
|
||||
# where <operator> is '=', '!=', '<', '>', '<=', '>='
|
||||
# - address <wildcard>
|
||||
# where <wildcard> is an (possibly incomplete) fidonet address,
|
||||
# e.g. "5020/*"
|
||||
# - time <interval>[,<interval>,...]
|
||||
# where <interval> is a day spec. with optional time spec., e.g.
|
||||
# Wk2000-0900,Sat1800-0000,Sun
|
||||
# - phone <prefix>
|
||||
# e.g. "phone 7-095-"
|
||||
|
||||
# Dialing parameters
|
||||
# of multiple "ModemPort", "ModemReset", "ModemDial", "ModemHangup" lines,
|
||||
# first matching is used.
|
||||
# of multiple "PhoneTrans", "ModemConnect", "ModemError" lines, all matching
|
||||
# are used.
|
||||
# In send and expect strings, following substitutions are made:
|
||||
# \\ '\' character
|
||||
# \r carriage return (0x0d)
|
||||
# \n new line (0x0a)
|
||||
# \t tab (0x09)
|
||||
# \b backspace (0x08)
|
||||
# \s space (0x20)
|
||||
# \NNN (where N is an octal digit) - character with octal code NNN
|
||||
# \d 1 second delay (send strings only)
|
||||
# \p 1/4 second pause (send strings only)
|
||||
# \T translated telephone no. (send strings only)
|
||||
# \D untranslated telephone no. (send strings only)
|
||||
|
||||
# ModemPort present a blank-separated list of ports with possible speed
|
||||
# extention (separated by colon); if speed is prefixed with 'L', it is
|
||||
# a "locked" port speed, otherwise it is a maximum speed to be set, while
|
||||
# actual speed is taken from the nodelist. If speed is omitted (or set
|
||||
# to zero), previous port speed is not changed.
|
||||
#ModemPort (time Any0000-0900,Sat,Sun) ttyS0
|
||||
#ModemPort cua0:L38400
|
@ -1,30 +0,0 @@
|
||||
ModemHangup +++ATH\r
|
||||
ModemOK OK
|
||||
ModemConnect CONNECT
|
||||
ModemError BUSY
|
||||
ModemError NO\sCARRIER
|
||||
ModemError NO\sDIAL
|
||||
ModemError RING\r
|
||||
ModemError ERROR
|
||||
|
||||
# Call options (time, address and nodelist flag dependant)
|
||||
# All matching are applied in the order they are specified.
|
||||
# Possible options are "[No]Call", "[No]Hold", "[No]PUA", "[No]EMSI",
|
||||
# "[No]WaZOO", "[No]Freqs", "[No]Zmodem", "[No]ZedZap", "[No]Janus",
|
||||
# "[No]Hydra". Here, WaZOO stands for YooHoo/2U2 handshake, not for
|
||||
# the transfer scheme. FTS-0001 handshake and DietIFNA scheme cannot
|
||||
# be disallowed (because they are mandatory by standart). "Hold"
|
||||
# means really hold "hold" type packets and files: do not send them
|
||||
# if our system initiated the session, "NoHold" means send "hold"
|
||||
# packets when our system initiated the session. "NoPUA" stands for
|
||||
# "No PickUp All", i.e. PUP ("Pick Up Primary"). NoCall means do not
|
||||
# perform outbound call. This flag has no effect on the nodes
|
||||
# explicitly specified in the command line.
|
||||
# Default options are "everything allowed".
|
||||
# options ((!CM) & time Any0700-0200) Nocall
|
||||
#options (time Any0900-2100 & ! address 2:5020/*) Nocall
|
||||
|
||||
# EMSI data for this node
|
||||
# From this line on values CANNOT be prefixed with logical expression
|
||||
# For now, escaping of '}' and ']' unimplemented, try to avoid these
|
||||
# characters please!
|
@ -1,14 +0,0 @@
|
||||
|
||||
# PhoneTrans lines provide rules to change phone prefixes to make local
|
||||
# or long-distance calls. In the example below, my country code is 7,
|
||||
# and local dialing area is 095. From the numbers starting with "7-095-"
|
||||
# the prefix is stripped and the 7-digit remainder is dialed. For
|
||||
# the numbers starting with "7-" but not with "7-095-", the country prefix
|
||||
# "7-" is stripped and the long-distance dialing prefix "8W" substituted.
|
||||
# For the numbers not matching any of the above, international
|
||||
# call is performed: international dialing prefix "8W10" is prepended
|
||||
# to the unmodified 11-digit number. Generally, the syntax is:
|
||||
# "PhoneTrans <what-to-strip> / <what-to-substitute-instead>"
|
||||
#PhoneTrans 7-095- /
|
||||
#PhoneTrans 7- / 8W
|
||||
#PhoneTrans / 8W10
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
# ver 0.7
|
||||
# ifpoll, poll my boss node or the node given as argument 1
|
||||
#
|
||||
# i start this shell script every day by crond, but you can
|
||||
# start it also by hand :) start it as the owner of ifcico.
|
||||
# rasca, berlin 1993 (Rasca Gmelch, 2:2410/305.4)
|
||||
#
|
||||
# where "ifcico" and "ifpack" reside
|
@ -1,109 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id: copi.ifpoll2,v 1.2 2012/06/29 22:33:42 tom Exp $
|
||||
|
||||
# Packets backup directory - You have to CREATE this directory
|
||||
BAK=/var/spool/ifmail/BAK
|
||||
|
||||
# logfile of ifcico
|
||||
IFLOG=/var/log/ifmail/sysiflog
|
||||
|
||||
# log archive
|
||||
IFLOGARC=/var/log/ifmail/TheLog
|
||||
|
||||
# owner of "ifcico"
|
||||
IFCICO_OWNER=fnet
|
||||
|
||||
# how often should i try to call NODE?
|
||||
MaxTry=30
|
||||
|
||||
# delay between outgoing calls in seconds
|
||||
DELAY=10
|
||||
|
||||
# where to log processing - file or tty/console
|
||||
INFO_TTY=/dev/console
|
||||
|
||||
# Lets backup the log and use a new one
|
||||
if [ -e $IFLOG ]; then
|
||||
echo Rearranging logs...
|
||||
cat $IFLOG >> $IFLOGARC
|
||||
cp /dev/null $IFLOG
|
||||
fi
|
||||
|
||||
echo "`date \"+%b %d %T\"` ifpoll[$$]: starting" # >> $INFO_TTY
|
||||
|
||||
# remember me, not to run as root..
|
||||
#
|
||||
if [ `whoami` != "$IFCICO_OWNER" ]; then
|
||||
echo "*** run $0 as the owner of ifcico ***"
|
||||
echo "`date \"+%b %d %T\"` ifpoll[$$]: wrong uid (rc 2)" # >> $INFO_TTY
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# argv[1] is the optional node to call
|
||||
#
|
||||
if [ "$1" != "" ]; then
|
||||
if [ "$1" = "-?" ] || [ "$1" = "-h" ]; then
|
||||
echo "usage: ifpoll [<node>]"
|
||||
exit 3
|
||||
else
|
||||
NODE=$1
|
||||
fi
|
||||
fi
|
||||
|
||||
# let's pack the fido stuff..
|
||||
#
|
||||
$FIDOPATH/ifpack
|
||||
|
||||
# loop until ifcico could connect the node or MaxTry is encountered
|
||||
#
|
||||
i=1; errlv=1
|
||||
while let 'i <= MaxTry' && let 'errlv != 0'
|
||||
do
|
||||
echo -n "`date \"+%b %d %T\"` ifpoll[$$]: $i. try ($NODE) " # >> $INFO_TTY
|
||||
#
|
||||
# start ifcico in master mode ..
|
||||
#
|
||||
$FIDOPATH/ifcico -r 1 $NODE
|
||||
errlv=$?
|
||||
if [ $errlv != "0" ]; then
|
||||
echo "failed" # >> $INFO_TTY
|
||||
if [ $i != $MaxTry ]; then
|
||||
sleep $DELAY
|
||||
fi
|
||||
let i=i+1
|
||||
else
|
||||
echo "ok :)" # >> $INFO_TTY
|
||||
fi
|
||||
done
|
||||
|
||||
# if the poll was fine, unpacking..
|
||||
#
|
||||
if [ $errlv = "0" ]; then
|
||||
echo "`date \"+%b %d %T\"` ifpoll[$$]: unpacking.. " # >> $INFO_TTY
|
||||
cp -f /var/spool/ifmail/inb/*.* $BAK
|
||||
$FIDOPATH/ifunpack
|
||||
# add here some additional lines for processing tic files or
|
||||
# incoming file-lists or simular..
|
||||
else
|
||||
# write me a mail about the failed poll
|
||||
tail --lines=20 $IFLOG | elm -s "ifpoll: failed" $IFCICO_SYSOP >/dev/null
|
||||
fi
|
||||
|
||||
echo "`date \"+%b %d %T\"` ifpoll[$$]: finished (rc $errlv)" # >> $INFO_TTY
|
||||
|
||||
# Collect some infos...
|
||||
echo ""
|
||||
echo "*** Outgoing File Transfer Stats: ***"
|
||||
grep sent $IFLOG
|
||||
echo "*** Incoming File Transfer Stats: ***"
|
||||
grep received $IFLOG
|
||||
echo ""
|
||||
|
||||
echo "---->> New mail: <<-----"
|
||||
grep echomail $IFLOG
|
||||
echo "---->> Personal mail: <<-----"
|
||||
grep "mail from" $IFLOG
|
||||
echo ""
|
||||
|
||||
# return the errorlevel of ifcico
|
||||
exit $errlv
|
@ -1,20 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
$ver = "0.4";
|
||||
#
|
||||
# this perl script is designed for the ifmail package by eugene grosser.
|
||||
#
|
||||
# request a file (first argument) from a fido-node (second argument),
|
||||
# don't forget to quote if you use wildcards, e.g.:
|
||||
|
||||
# ifreq 'files*' 2:2410/305
|
||||
# or
|
||||
# ifreq 'files newfile' 2:2410/305
|
||||
#
|
||||
# this perl script does only add an entry to the corresponding flo-file,
|
||||
# the mailer ifcico is not started!
|
||||
#
|
||||
# rasca, berlin 1994 (rasca@marie.physik.tu-berlin.de, 2:2410/305.4)
|
||||
#
|
||||
# multi-zone support added by
|
||||
# Roland Rosenfeld 15.05.1994 (roland@p13.flokiste.fido.de, 2:2450/300.13)
|
||||
|
@ -1,71 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: copi.ifreq2,v 1.2 2012/06/29 22:33:42 tom Exp $
|
||||
#
|
||||
# this is the base directory, where the req-files are stored and the
|
||||
# default outbound
|
||||
$flo_path = "/var/spool/ifmail";
|
||||
$outbound = "/outb"; # don't be confused, it means "/var/spool/ifmail/outb"
|
||||
|
||||
# end of configuration #############################################
|
||||
|
||||
# main()
|
||||
#
|
||||
if ((@ARGV < 1) || @ARGV > 2 || $ARGV[0] eq "-?") {
|
||||
&usage;
|
||||
} elsif ($ARGV[1] ne "") {
|
||||
$node = $ARGV[1];
|
||||
}
|
||||
$file = $ARGV[0];
|
||||
|
||||
if (! ($node =~ /\d+:\d+\/\d+/)) {
|
||||
die "Wrong address: $node!!!";
|
||||
}
|
||||
|
||||
($zone, $netnode) = split (/:/, $node);
|
||||
$reqfile = sprintf("%04x%04x", split(/\//, $netnode));
|
||||
|
||||
if ($reqfile eq "00000000") {
|
||||
print ("can't resolve the fido address \"$node\"\n");
|
||||
&usage;
|
||||
} else {
|
||||
if ( $zone == 2 ) {
|
||||
$reqfile = $flo_path . $outbound . "/" . $reqfile . ".req";
|
||||
} elsif ( $zone < 7 ) {
|
||||
$reqfile = $flo_path . $outbound . ".00$zone/" . $reqfile . ".req";
|
||||
} else {
|
||||
$outbound = "";
|
||||
open (CONFIG, "< $config") || die "can't open $config";
|
||||
while ($_ = <CONFIG>) {
|
||||
if ( /^address.*$zone:.*\@(\w*)/ ) { $outbound = $1; }
|
||||
}
|
||||
if ( $outbound eq "" ) {
|
||||
die "No Zone $zone found in $config";
|
||||
}
|
||||
$reqfile = $flo_path . "/$outbound/" . $reqfile . ".req";
|
||||
}
|
||||
|
||||
# seperate the file names of the first argument
|
||||
@files = split (/\s+/, $ARGV[0]);
|
||||
|
||||
# open the flofile for appending
|
||||
open(FLOFILE, ">>" . $reqfile) || die "can't open $reqfile";
|
||||
while (@files) {
|
||||
print (FLOFILE shift(@files), "\n");
|
||||
}
|
||||
close(FLOFILE);
|
||||
|
||||
print ("--- fido request $ver ---------------------------\n");
|
||||
print ("requesting \"$file\" from fido-node $node\n");
|
||||
print ("--- executing ifstat .. ------------------------\n");
|
||||
system("ifstat");
|
||||
}
|
||||
|
||||
#
|
||||
# subroutine "usage"
|
||||
#
|
||||
sub usage {
|
||||
printf ("--- fido request %s -------------\n", $ver);
|
||||
printf ("usage: ifreq <file> [<3-d address>]\n");
|
||||
printf ("e.g. : ifreq FILES 2:2410/305\n");
|
||||
exit 1;
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
#! /bin/sh
|
||||
## $Revision: 1.1 $
|
||||
## News boot script.
|
||||
|
||||
## =()<. @<_PATH_SHELLVARS>@>()=
|
||||
. /usr/lib/news/innshellvars
|
||||
|
||||
## Pick ${INND} or ${INNDSTART}
|
||||
WHAT=${INNDSTART}
|
||||
## Set to true or false
|
||||
DOINNWATCH=false
|
||||
MAIL="${MAILCMD} -s 'Boot-time Usenet warning on `hostname`' ${NEWSMASTER}"
|
||||
|
||||
## RFLAG is set below; set FLAGS as appropriate.
|
||||
RFLAG=""
|
||||
FLAGS="-i0 -c0"
|
||||
|
||||
## Clean shutdown?
|
||||
if [ -f ${SERVERPID} ] ; then
|
||||
( echo 'INND: PID file exists -- unclean shutdown!' >/dev/console )
|
||||
RFLAG="-r"
|
||||
fi
|
||||
|
||||
if [ ! -f ${NEWSLIB}/.news.daily ] ; then
|
||||
echo 'No .news.daily file; need to run news.daily?' | eval ${MAIL}
|
||||
else
|
||||
case `find ${NEWSLIB} -name .news.daily -mtime +1 -print 2>/dev/null` in
|
||||
"")
|
||||
;;
|
||||
*)
|
||||
echo 'Old .news.daily file; need to run news.daily?' | eval ${MAIL}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Active file recovery.
|
||||
if [ ! -s ${ACTIVE} ] ; then
|
||||
if [ -s ${NEWACTIVE} ] ; then
|
||||
mv ${NEWACTIVE} ${ACTIVE}
|
||||
else
|
||||
if [ -s ${OLDACTIVE} ] ; then
|
||||
cp ${OLDACTIVE} ${ACTIVE}
|
||||
else
|
||||
( echo 'INND: No active file!' >/dev/console )
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
RFLAG="-r"
|
||||
# You might want to rebuild the DBZ database, too:
|
||||
#echo "cd ${NEWSLIB} \
|
||||
# && makehistory -r \
|
||||
# && mv history.n.dir history.dir \
|
||||
# && mv history.n.pag history.pag" | su ${NEWSUSER}
|
||||
fi
|
||||
|
||||
## Remove temporary batchfiles and lock files.
|
||||
( cd ${BATCH} && rm -f bch* )
|
||||
( cd ${LOCKS} && rm -f LOCK* )
|
||||
( cd ${TEMPSOCKDIR} && rm -f ${TEMPSOCK} )
|
||||
rm -f ${NEWSCONTROL} ${NNTPCONNECT} ${SERVERPID}
|
||||
|
||||
## Start the show.
|
||||
( echo 'Starting innd.' >/dev/console )
|
||||
eval ${WHAT} ${RFLAG} ${FLAGS}
|
||||
|
||||
# Gee, looks like lisp, doesn't it?
|
||||
${DOINNWATCH} && {
|
||||
echo "( ( sleep 60 ; ${INNWATCH} ) & )" | su ${NEWSUSER}
|
||||
}
|
||||
|
||||
RMFILE=${MOST_LOGS}/expire.rm
|
||||
if [ -s ${MOST_LOGS}/expire.rm ] ; then
|
||||
( echo "Removing articles from pre-downtime expire run." >/dev/console )
|
||||
(
|
||||
echo 'System shut down during expire. Unlinking articles listed in'
|
||||
echo ${RMFILE}
|
||||
) | eval ${MAIL}
|
||||
echo "${NEWSBIN}/expirerm ${RMFILE}" | su ${NEWSUSER} &
|
||||
fi
|
@ -1,74 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id: copi.sendifm1,v 1.2 2012/06/29 22:33:42 tom Exp $
|
||||
## SH script to send UUCP batches out.
|
||||
|
||||
## =()<. @<_PATH_SHELLVARS>@>()=
|
||||
. ~news/innshellvars
|
||||
|
||||
PROGNAME=`basename $0`
|
||||
LOCK=${LOCKS}/LOCK.${PROGNAME}
|
||||
LOG=${MOST_LOGS}/${PROGNAME}.log
|
||||
|
||||
MAXJOBS=200
|
||||
UUXFLAGS="- -r -gd"
|
||||
|
||||
## Start logging.
|
||||
test ! -f ${LOG} && touch ${LOG}
|
||||
chmod 0660 ${LOG}
|
||||
exec >>${LOG} 2>&1
|
||||
echo "${PROGNAME}: [$$] begin `date`"
|
||||
cd ${BATCH}
|
||||
|
||||
## Anyone else there?
|
||||
trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
|
||||
shlock -p $$ -f ${LOCK} || {
|
||||
echo "${PROGNAME}: [$$] locked by [`cat ${LOCK}`]"
|
||||
exit 0
|
||||
}
|
||||
|
||||
## Who are we sending to?
|
||||
if [ -n "$1" ] ; then
|
||||
LIST="$*"
|
||||
else
|
||||
LIST=`ls /usr/spool/news/out.going|egrep "f[0-9]*.n[0-9]*$"`
|
||||
fi
|
||||
|
||||
case ${HAVE_UUSTAT} in
|
||||
DONT)
|
||||
TEMP=${TMPDIR}/uuq$$
|
||||
uuq -h |tr -d : >${TEMP}
|
||||
;;
|
||||
esac
|
||||
|
||||
## Do the work...
|
||||
|
||||
for SITE in ${LIST}; do
|
||||
|
||||
## See if any data is ready for host.
|
||||
BATCHFILE=${SITE}.uucp
|
||||
if [ -f ${SITE}.work ] ; then
|
||||
cat ${SITE}.work >>${BATCHFILE}
|
||||
rm -f ${SITE}.work
|
||||
fi
|
||||
mv ${SITE} ${SITE}.work
|
||||
ctlinnd -s -t30 flush ${SITE} || continue
|
||||
cat ${SITE}.work >>${BATCHFILE}
|
||||
rm -f ${SITE}.work
|
||||
if [ ! -s ${BATCHFILE} ] ; then
|
||||
echo "${PROGNAME}: [$$] no articles for ${SITE}"
|
||||
rm -f ${BATCHFILE}
|
||||
continue
|
||||
fi
|
||||
|
||||
## Get the compression flags.
|
||||
echo "${PROGNAME}: [$$] begin ${SITE}"
|
||||
case "${SITE}" in
|
||||
phreak)
|
||||
COMPRESS="compress"
|
||||
;;
|
||||
*)
|
||||
COMPRESS="gzip"
|
||||
;;
|
||||
esac
|
||||
|
||||
time batcher \
|
@ -1,15 +0,0 @@
|
||||
${SITE} ${BATCHFILE}
|
||||
|
||||
echo "${PROGNAME}: [$$] end ${SITE}"
|
||||
done
|
||||
|
||||
case ${HAVE_UUSTAT} in
|
||||
DONT)
|
||||
rm -f ${TEMP}
|
||||
;;
|
||||
esac
|
||||
|
||||
## Remove the lock file.
|
||||
rm -f ${LOCK}
|
||||
|
||||
echo "${PROGNAME}: [$$] end `date`"
|
@ -1,13 +0,0 @@
|
||||
TRNINIT="-x -e -X -F\" :> \""
|
||||
HIDELINE="^X-FTN"
|
||||
NEWSHEADER="Newsgroups: %(%F=^\$?%C:%F)
|
||||
Subject: %(%S=^\$?%\"\n\nSubject: \":%S)
|
||||
%(%R=^\$?:References: %R
|
||||
)Sender:
|
||||
Distribution: %(%i=^\$?%\"\nDistribution: \":%D)
|
||||
Organization: %o
|
||||
X-Comment-To: %f\n\n"
|
||||
ATTRIBUTION="%f writes:\n"
|
||||
YOUSAID="In article %i \n of newsgroup %C you write about \"%s\":\n"
|
||||
MAILCALL="(New Mail)"
|
||||
export NEWSHEADER HIDELINE TRNINIT ATTRIBUTION MAILCALL YOUSAID EDITOR
|
@ -1,54 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $Id: copi.wheel,v 1.4 2012/06/29 10:53:52 tom Exp $
|
||||
|
||||
mkstemp size
|
||||
dialog --print-maxsize 2>$tmp_size
|
||||
ROWS="`cut $tmp_size -f1 -d, | cut -f2 -d:`"
|
||||
COLS="`cut $tmp_size -f2 -d,`"
|
||||
rm $tmp_size
|
||||
|
||||
# Takes an integer, multiplies it for COLS, divides for 132
|
||||
scalex() {
|
||||
expr $1 \* $COLS / 132
|
||||
}
|
||||
scaley() {
|
||||
expr $1 \* $ROWS / 60
|
||||
}
|
||||
|
||||
dialog --backtitle "$TITLE" --no-shadow \
|
||||
--begin `scaley 27` `scalex 98` --infobox "pushd /var/log >/dev/null" 0 0 --and-widget \
|
||||
--begin `scaley 35` `scalex 95` --infobox "mkdir -p news -m 755" 0 0 --and-widget \
|
||||
--begin `scaley 45` `scalex 86` --infobox "chown news.news news" 0 0 --and-widget \
|
||||
--begin `scaley 48` `scalex 78` --infobox "cd /var/log/news" 0 0 --and-widget \
|
||||
--begin `scaley 51` `scalex 61` --infobox "mkdir -p OLD -m 755" 0 0 --and-widget \
|
||||
--begin `scaley 52` `scalex 47` --infobox "chown news.news OLD" 0 0 --and-widget \
|
||||
--begin `scaley 51` `scalex 40` --infobox "cd /var/spool" 0 0 --and-widget \
|
||||
--begin `scaley 48` `scalex 25` --infobox "mkdir -p news -m 775" 0 0 --and-widget \
|
||||
--begin `scaley 42` `scalex 13` --infobox "chown news.news news" 0 0 --and-widget \
|
||||
--begin `scaley 35` `scalex 4` --infobox "cd /var/spool/news" 0 0 --and-widget \
|
||||
--begin `scaley 27` `scalex 2` --infobox "CURMASK=`umask`" 0 0 --and-widget \
|
||||
--begin `scaley 19` `scalex 4` --infobox "umask 02" 0 0 --and-widget \
|
||||
--begin `scaley 11` `scalex 13` --infobox "mkdir -p out.going control junk in.coming" 0 0 --and-widget \
|
||||
--begin `scaley 5` `scalex 25` --infobox "chown news.news out.going control junk in.coming" 0 0 --and-widget \
|
||||
--begin `scaley 2` `scalex 37` --infobox "cd in.coming" 0 0 --and-widget \
|
||||
--begin `scaley 1` `scalex 46` --infobox "mkdir -p bad tmp" 0 0 --and-widget \
|
||||
--begin `scaley 2` `scalex 61` --infobox "chown news.news bad tmp" 0 0 --and-widget \
|
||||
--begin `scaley 5` `scalex 76` --infobox "umask $CURMASK" 0 0 --and-widget \
|
||||
--begin `scaley 11` `scalex 87` --infobox "ln -sf ~news /usr/local/lib/" 0 0 --and-widget \
|
||||
--begin `scaley 18` `scalex 95` --infobox "ln -sf ~news/inews /usr/bin/" 0 0 --and-widget \
|
||||
--begin `scaley 26` `scalex 97` --infobox "chmod 1777 /var/tmp" 0 0 --and-widget \
|
||||
--begin `scaley 34` `scalex 95` --infobox "cd ~news" 0 0 --and-widget \
|
||||
--begin `scaley 42` `scalex 87` --infobox "touch history history.dir history.pag errlog log" 0 0 --and-widget \
|
||||
--begin `scaley 47` `scalex 76` --infobox "chown news.news history* log errlog" 0 0 --and-widget \
|
||||
--sleep 1 --infobox "Creating spooling and logging directories and files..." 0 0 --and-widget \
|
||||
--begin `scaley 51` `scalex 78` --infobox "chmod 664 history* log errlog" 0 0 --and-widget \
|
||||
--begin `scaley 52` `scalex 60` --infobox "echo \"control 0000000000 0000000001 y\" > active" 0 0 --and-widget \
|
||||
--begin `scaley 51` `scalex 42` --infobox "echo \"junk 0000000000 0000000001 y\" >> active" 0 0 --and-widget \
|
||||
--begin `scaley 48` `scalex 26` --infobox "chown news.news active" 0 0 --and-widget \
|
||||
--begin `scaley 42` `scalex 13` --infobox "echo \"control 814573260 usenet\" > active.times" 0 0 --and-widget \
|
||||
--begin `scaley 35` `scalex 4` --infobox "echo \"junk 814573260 usenet\" >> active.times" 0 0 --and-widget \
|
||||
--begin `scaley 27` `scalex 2` --infobox "chown news.news active.times" 0 0 --and-widget \
|
||||
--begin `scaley 19` `scalex 4` --infobox ":>newsgroups" 0 0 --and-widget \
|
||||
--begin `scaley 11` `scalex 12` --infobox "chown news.news newsgroups" 0 0 --and-widget \
|
||||
--begin `scaley 6` `scalex 25` --infobox "popd >/dev/null" 0 0
|
||||
sleep 1
|
@ -1,101 +0,0 @@
|
||||
--- ifgate/message.c.orig Mon Jul 24 15:17:47 1995
|
||||
+++ ifgate/message.c Mon Jul 24 15:18:00 1995
|
||||
@@ -48,12 +48,26 @@
|
||||
if (!strcasecmp(msg->key,"X-UUCP-From")) return 0;
|
||||
if (!strcasecmp(msg->key,"X-Body-Start")) return 0;
|
||||
if (!strncasecmp(msg->key,"X-FTN-",6)) return 0;
|
||||
- if (!strcasecmp(msg->key,"Path")) return isftnpath(msg->val)?0:1;
|
||||
+ if (!strcasecmp(msg->key,"Path"))
|
||||
+
|
||||
+#ifdef LESS_RFC_KLUDGES
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return isftnpath(msg->val)?0:1;
|
||||
+#endif
|
||||
+
|
||||
if (!strcasecmp(msg->key,"Newsgroups")) return newsmode?0:2;
|
||||
if (!strcasecmp(msg->key,"Xref")) return 0;
|
||||
if (!strcasecmp(msg->key,"Return-Receipt-To")) return 1;
|
||||
if (!strcasecmp(msg->key,"Received")) return newsmode?0:2;
|
||||
- if (!strcasecmp(msg->key,"From")) return ftnorigin?0:2;
|
||||
+ if (!strcasecmp(msg->key,"From"))
|
||||
+
|
||||
+#ifdef LESS_RFC_KLUDGES
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return ftnorigin?0:2;
|
||||
+#endif
|
||||
+
|
||||
if (!strcasecmp(msg->key,"To"))
|
||||
{
|
||||
if (newsmode) return 0;
|
||||
@@ -66,7 +80,14 @@
|
||||
}
|
||||
if (!strcasecmp(msg->key,"Cc")) return 2;
|
||||
if (!strcasecmp(msg->key,"Bcc")) return 2;
|
||||
- if (!strcasecmp(msg->key,"Reply-To")) return 2;
|
||||
+ if (!strcasecmp(msg->key,"Reply-To"))
|
||||
+
|
||||
+#ifdef LESS_RFC_KLUDGES
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return 2;
|
||||
+#endif
|
||||
+
|
||||
if (!strcasecmp(msg->key,"Lines")) return 0;
|
||||
if (!strcasecmp(msg->key,"Date")) return 0;
|
||||
if (!strcasecmp(msg->key,"Subject"))
|
||||
@@ -77,8 +98,22 @@
|
||||
if (!strcasecmp(msg->key,"Organization")) return removeorg?0:1;
|
||||
if (!strcasecmp(msg->key,"Comment-To")) return 0;
|
||||
if (!strcasecmp(msg->key,"X-Comment-To")) return 0;
|
||||
- if (!strcasecmp(msg->key,"Keywords")) return 2;
|
||||
- if (!strcasecmp(msg->key,"Summary")) return 2;
|
||||
+ if (!strcasecmp(msg->key,"Keywords"))
|
||||
+
|
||||
+#ifdef LESS_RFC_KLUDGES
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return 2;
|
||||
+#endif
|
||||
+
|
||||
+ if (!strcasecmp(msg->key,"Summary"))
|
||||
+
|
||||
+#ifdef LESS_RFC_KLUDGES
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return 2;
|
||||
+#endif
|
||||
+
|
||||
if (!strcasecmp(msg->key,"MIME-Version")) return removemime?0:1;
|
||||
if (!strcasecmp(msg->key,"Content-Type")) return removemime?0:1;
|
||||
if (!strcasecmp(msg->key,"Content-Length")) return removemime?0:1;
|
||||
@@ -86,8 +121,26 @@
|
||||
if (!strcasecmp(msg->key,"Content-Name")) return 2;
|
||||
if (!strcasecmp(msg->key,"Content-Description")) return 2;
|
||||
if (!strcasecmp(msg->key,"Message-ID")) return ftnorigin?0:1;
|
||||
- if (!strcasecmp(msg->key,"References")) return removeref?0:1;
|
||||
- if (!strcasecmp(msg->key,"Distribution")) return ftnorigin?0:1;
|
||||
+ if (!strcasecmp(msg->key,"References"))
|
||||
+
|
||||
+#ifdef LESS_RFC_KLUDGES
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return removeref?0:1;
|
||||
+#endif
|
||||
+
|
||||
+ if (!strcasecmp(msg->key,"Distribution"))
|
||||
+
|
||||
+#ifdef LESS_RFC_KLUDGES
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return ftnorigin?0:1;
|
||||
+#endif
|
||||
+
|
||||
+#ifdef LESS_RFC_KLUDGES
|
||||
+ if (!strcasecmp(msg->key,"NNTP-Posting-Host")) return 0;
|
||||
+#endif
|
||||
+
|
||||
/*if (!strcasecmp(msg->key,"")) return ;*/
|
||||
return 1;
|
||||
}
|
@ -1,296 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# $Id: copismall,v 1.9 2012/02/16 01:29:39 Pedro.Giffuni Exp $
|
||||
#
|
||||
# ComeOn Point Installer! v0.9a.small (small version for cdialog v0.9a)
|
||||
# - installa il point in modo visuale e auto-detecting. Versione light.
|
||||
#
|
||||
# AUTHOR: Beppe (beppe.dem@nsm.it)
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
|
||||
# THIS IS NOT THE ORIGINAL VERSION!!!! This files was adequate to be
|
||||
# a demo for cdialog v0.9a+. However it doesn't include all its features.
|
||||
# Look for one of the free ComeOn Linux! tools to have a complete
|
||||
# demo of cdialog. ComeOn Linux! follows the GNU philosophy.
|
||||
# Send peacefully a mail to demarco_p@abramo.it for more info.
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
#COMEONDIR=/usr/lib/ComeOn
|
||||
#POINTDIR=$COMEONDIR/point
|
||||
POINTDIR=`pwd`
|
||||
|
||||
AKASETUP=$POINTDIR/.akasetup
|
||||
PNTSETUP=$POINTDIR/.pntsetup
|
||||
EMSIFILE=$POINTDIR/.emsi
|
||||
COPIUSER=$POINTDIR/.copi.user
|
||||
COPIVER=v0.9a.small
|
||||
TITLE="ComeOn Point Installer! $COPIVER -+- (c) 1996 ComeOn Linux!"
|
||||
|
||||
#FUNCSVER=v0.9.2
|
||||
#FUNCSDIR=$POINTDIR/funcs-$FUNCSVER
|
||||
FUNCSDIR=$POINTDIR/copifuncs
|
||||
|
||||
#COPIDIR=$POINTDIR/copi-$COPIVER
|
||||
#. $COPIDIR/copishellvars
|
||||
|
||||
#POINTVER="v1.1" # ComeOn Point version
|
||||
|
||||
if [ $LOGNAME != root ]
|
||||
then
|
||||
$DIALOG --backtitle "$TITLE" --title "Error!" --beep --msgbox "Questo programma per funzionare correttamente deve essere avviato dall'amministratore di sistema (root)." 0 0
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
$DIALOG --backtitle "$TITLE" --title "Are you sure?" --cr-wrap --msgbox "Questo installer procedera' in modalita'
|
||||
auto-detect all'installazione del point.
|
||||
Premi <Enter> per iniziare o <Esc> per uscire. " 0 0
|
||||
|
||||
if [ $? = $DIALOG_CANCEL -o $? = $DIALOG_ESC ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
pushd $FUNCSDIR >/dev/null
|
||||
. ./copi.funcs
|
||||
. ./common.funcs
|
||||
. ./admin.funcs
|
||||
|
||||
###############################################################################
|
||||
find_incompatible_packages
|
||||
|
||||
if [ "$PKG_TO_REMOVE" ]
|
||||
then
|
||||
$DIALOG --backtitle "$TITLE" --beep --title "Problem detected" --msgbox "Attenzione, prima di poter continuare bisogna avviare pkgtool e rimuovere i seguenti packages: $PKG_TO_REMOVE." 0 0
|
||||
exit
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
mkstemp dialog
|
||||
|
||||
find_necessary_packages
|
||||
|
||||
if [ "$PKG_TO_INSTALL" ]
|
||||
then
|
||||
echo -n "Attenzione, prima di poter continuare bisogna avviare setup ed installare i seguenti packages dai disk sets N (quelli del Networking): $PKG_TO_INSTALL." >$tmp_dialog
|
||||
|
||||
if [ "`echo $PKG_TO_INSTALL | grep tcpip`" ]
|
||||
then
|
||||
echo -n " Ricordarsi poi di effettuare lo shutdown per rendere effettive le modifiche." >>$tmp_dialog
|
||||
fi
|
||||
|
||||
$DIALOG --backtitle "$TITLE" --beep --title "Problem detected" --msgbox "`cat $tmp_dialog`" 0 0
|
||||
|
||||
rm $tmp_dialog
|
||||
exit
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
mkstemp smailp
|
||||
|
||||
SMAILTGZ=""
|
||||
if [ ! -d /usr/lib/smail ]
|
||||
then
|
||||
$DIALOG --backtitle "$TITLE" --title "Smail not found" --inputbox "Bisogna installare Smail, per cui inserire il percorso completo di dove trovarne i binari compressi" 0 0 "/cdrom/sunsite/system/Mail/delivery/smail-linuxbin-3.1.29.1.tar.gz" 2>$tmp_smailp
|
||||
SMAILTGZ="`cat $tmp_smailp`"
|
||||
rm $tmp_smailp
|
||||
while [ ! -f "$SMAILTGZ" ]
|
||||
do
|
||||
$DIALOG --backtitle "$TITLE" --beep --title "Archive not found" --inputbox "Percorso di file \"$SMAILTGZ\" non valido, controllarne la correttezza." 0 0 "/cdrom/sunsite/system/Mail/delivery/smail-linuxbin-3.1.29.1.tar.gz" 2>$tmp_smailp
|
||||
SMAILTGZ="`cat $tmp_smailp`"
|
||||
rm $tmp_smailp
|
||||
done
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
mkstemp target
|
||||
mkstemp asetup
|
||||
mkstemp psetup
|
||||
|
||||
AKA=""
|
||||
while [ ! "$AKA" ]
|
||||
do
|
||||
$DIALOG --backtitle "$TITLE" --title "Primary address" --inputbox "Inserire il proprio address principale, completo di point e di domain. Il poll sara' effettuato per default dal boss corrispondente." 0 0 "2:335/722.7@fidonet" 2>$tmp_target
|
||||
AKAFTN="`cat $tmp_target`"
|
||||
rm $tmp_target
|
||||
fidonetpoint2int $AKAFTN
|
||||
AKA="$_RETVAL"
|
||||
done
|
||||
echo -n "`echo $AKA | cut -f2- -d.`:" >$tmp_asetup
|
||||
echo -n "`echo $AKA | cut -f1 -d. | cut -c2-`:" >$tmp_psetup
|
||||
AKASFTN="$AKAFTN"
|
||||
AKAS="$AKA"
|
||||
while [ "$AKAFTN" ]
|
||||
do
|
||||
$DIALOG --backtitle "$TITLE" --title "AKAs" --inputbox "Inserire un eventuale address secondario, oppure lasciare la riga vuota per proseguire. Attenzione: nel caso si abbiano piu' indirizzi sulla stessa rete, bisognera' configurare solo uno di questi. Gli indirizzi correntemente definiti sono: $AKASFTN" 0 0 2>$tmp_target
|
||||
AKAFTN="`cat $tmp_target`"
|
||||
rm $tmp_target
|
||||
if [ "$AKAFTN" ]
|
||||
then
|
||||
fidonetpoint2int $AKAFTN
|
||||
AKA="$_RETVAL"
|
||||
if [ "`echo $AKAS | grep \".\`echo $AKA | cut -f5 -d.\`.\"`" ]
|
||||
then
|
||||
$DIALOG --backtitle "$TITLE" --beep --title "Invalid address" --msgbox "Non si possono avere piu' indirizzi sullo stesso dominio (net)." 0 0
|
||||
else
|
||||
AKASFTN="$AKASFTN $AKAFTN"
|
||||
AKAS="$AKAS $AKA"
|
||||
echo -n "`echo $AKA | cut -f2- -d.`:" >>$tmp_asetup
|
||||
echo -n "`echo $AKA | cut -f1 -d. | cut -c2-`:" >>$tmp_psetup
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo ":" >>$tmp_asetup
|
||||
echo ":" >>$tmp_psetup
|
||||
save $AKASETUP
|
||||
save $PNTSETUP
|
||||
mv $tmp_asetup $AKASETUP
|
||||
mv $tmp_psetup $PNTSETUP
|
||||
|
||||
###############################################################################
|
||||
mkstemp hostnm
|
||||
|
||||
$DIALOG --backtitle "$TITLE" --title "Hostname" --inputbox "Inserire l'hostname di questo computer qualora si abbia una rete gia' configurata, altrimenti inventarne uno fittizio da assegnare e questa macchina verra' configurata per il loopback." 0 0 "quark.comeon.org" 2>$tmp_hostnm
|
||||
NEW_HOSTNAME="`cat $tmp_hostnm`"
|
||||
rm $tmp_hostnm
|
||||
|
||||
###############################################################################
|
||||
mkstemp master
|
||||
|
||||
$DIALOG --backtitle "$TITLE" --title "Point admin" --inputbox "Scegliere l'user principale per la gestione e l'uso del point. Se l'user non esiste, verra' creato. Se esiste, ne verranno adattate le informazioni quali nome, gruppi, etc." 0 0 "beppe" --and-widget --title "Insert SysOp's name" --inputbox "Inserire nome e cognome del gestore ed utilizzatore principale del point (il proprio nome)." 0 0 "Giuseppe De Marco" --and-widget --title "Choose editor" --inputbox "Scegliere l'editor da usare per scrivere i messaggi" 0 0 "vim" 2>$tmp_master
|
||||
POST_USER="`cut $tmp_master -f1`"
|
||||
POST_NAME="`cut $tmp_master -f2`"
|
||||
POST_EDIT="`cut $tmp_master -f3`"
|
||||
rm $tmp_master
|
||||
save $COPIUSER
|
||||
echo $POST_USER >$COPIUSER
|
||||
|
||||
###############################################################################
|
||||
mkstemp expire
|
||||
mkstemp origin
|
||||
|
||||
$DIALOG --backtitle "$TITLE" --title "Origin" --inputbox "Scegliere l'Origin del sistema" 9 60 "$POST_USER's linux box" 2>$tmp_origin
|
||||
NEW_ORIGIN="`cat $tmp_origin`"
|
||||
rm $tmp_origin
|
||||
|
||||
$DIALOG --backtitle "$TITLE" --title "News expiring" --inputbox "Decidere per quanti giorni i messaggi echomail (le news) dovranno transitare sul sistema prima di venire cancellati automaticamente da news.daily. Inserire never se si vuole che non vengano mai cancellati. Sono ammesse cifre decimali (i.e. 25.5). Notare comunque che il valore qui inserito e' quello di default, ma per ogni singola area (newsgroup) sara' possibile specificare poi un valore appropriato." 0 0 "30" 2>$tmp_expire
|
||||
KEEPDAYS="`cat $tmp_expire`"
|
||||
rm $tmp_expire
|
||||
|
||||
###############################################################################
|
||||
mkstemp dialer
|
||||
mkstemp ifmail
|
||||
mkstemp mailvr
|
||||
mkstemp passwd
|
||||
|
||||
IFMAILTGZ=""
|
||||
IFMAILVERS=""
|
||||
if [ ! -d /usr/lib/ifmail -o ! -d /etc/ifmail -o ! -d /var/log/ifmail -o ! -f /usr/lib/ifmail/ifcico ]
|
||||
then
|
||||
$DIALOG --backtitle "$TITLE" --title "ifmail not found" --inputbox "Inserire il percorso COMPLETO dei sorgenti compressi di ifmail che verranno decompressi in /usr/src e compilati." 0 0 "/cdrom/sunsite/system/Mail/transport/ifmail-2.8b.tar.gz" 2>$tmp_ifmail
|
||||
IFMAILTGZ="`cat $tmp_ifmail`"
|
||||
rm $tmp_ifmail
|
||||
while [ ! -f "$IFMAILTGZ" ]
|
||||
do
|
||||
$DIALOG --backtitle "$TITLE" --beep --title "invalid filename" --inputbox "Percorso di file \"$IFMAILTGZ\" non valido, controllarne la correttezza." 0 0 "/cdrom/sunsite/system/Mail/transport/ifmail-2.8b.tar.gz" 2>$tmp_ifmail
|
||||
IFMAILTGZ="`cat $tmp_ifmail`"
|
||||
rm $tmp_ifmail
|
||||
done
|
||||
|
||||
$DIALOG --backtitle "$TITLE" --title "ifmail version" --inputbox "Specificare la versione di ifmail" 0 0 "2.8b" 2>$tmp_mailvr
|
||||
IFMAILVERS="`cat $tmp_mailvr` + ComeOn Point $POINTVER"
|
||||
rm $tmp_mailvr
|
||||
fi
|
||||
|
||||
IAKA=1
|
||||
PASSW=""
|
||||
AKA="`cut $AKASETUP -f$IAKA -d:`"
|
||||
while [ "$AKA" ]
|
||||
do
|
||||
int2fido $AKA
|
||||
AKAFTN="$_RETVAL"
|
||||
$DIALOG --backtitle "$TITLE" --title "Password" --inputbox "Specificare la password di sessione e per i pacchetti per il nodo $AKAFTN -- attenzione che alcuni mailers accettano solo passwords da 8 caratteri in maiuscolo!!" 0 0 "MYPASSWD" 2>$tmp_passwd
|
||||
PASSW="$PASSW`cat $tmp_passwd`:"
|
||||
rm $tmp_passwd
|
||||
IAKA=$[$IAKA+1]
|
||||
AKA="`cut $AKASETUP -f$IAKA -d:`"
|
||||
done
|
||||
PASSW="$PASSW:"
|
||||
|
||||
$DIALOG --backtitle "$TITLE" \
|
||||
--title "Modem speed" --inputbox "Specificare la velocita' del proprio modem (che sta su /dev/modem)" 0 0 "16800" --and-widget \
|
||||
--title "System name" --inputbox "Specificare il nome del sistema per il pacchetto EMSI" 0 0 "`cat $COPIUSER`'s linux point" --and-widget \
|
||||
--title "Location" --inputbox "Inserire la localita' fisica in cui risiede il sistema" 0 0 "Catanzaro, Italy - Europe" --and-widget \
|
||||
--title "Phone number" --inputbox "Inserire il proprio numero di telefono in formato internazionale, cioe' completo di doppio prefisso (xx-yyy-zzzzzz)" 0 0 "39-961-31997" --and-widget \
|
||||
--title "International call prefix" --inputbox "Specificare il prefisso da comporre per poter effettuare una chiamata internazionale (se ci si trova in Italia ad es. bisogna inserire 00)" 0 0 "00" --and-widget \
|
||||
--title "Long-distance call prefix" --inputbox "Specificare il prefisso da comporre per poter effettuare una chiamata interurbana in ambito nazionale, che verra' sostituito al prefisso della propria nazione quando incontrato in nodelist (per l'Italia ad es. bisogna inserire 0, che sostituira' il 39)" 0 0 "0" --and-widget \
|
||||
--title "Pointlist flags" --inputbox "Inserire eventuali flags stile pointlist per il pacchetto EMSI" 0 0 "MO,V32B,V42B,ZYX" --and-widget \
|
||||
--title "Modem dialing" --inputbox "Inserire la stringa da inviare al modem per comporre un numero telefonico" 0 0 "ATDT" 2>$tmp_dialer
|
||||
|
||||
echo -en "\t$POST_NAME\t\t" >>$tmp_dialer
|
||||
save $EMSIFILE
|
||||
mv $tmp_dialer $EMSIFILE
|
||||
|
||||
###############################################################################
|
||||
|
||||
if [ -d /etc/smail ]
|
||||
then
|
||||
SMAILCFGDIR=/etc/smail
|
||||
else
|
||||
SMAILCFGDIR=/usr/lib/smail
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
|
||||
$DIALOG --backtitle "$TITLE" --title "First step completed!" --msgbox "OK, ora ho tutte le informazioni necessarie per poter installare il point. Da qui in poi faro' tutto da solo, quindi ci si puo' tranquillamente andare a prendere un caffe'. :-)" 0 0
|
||||
|
||||
###############################################################################
|
||||
|
||||
killall sendmail 2>/dev/null
|
||||
if [ $SMAILTGZ ]; then tar zxvf $SMAILTGZ -C / >/dev/null; fi
|
||||
/usr/sbin/sendmail -bd -q15m
|
||||
|
||||
if [ ! "`ping -c1 $NEW_HOSTNAME | grep \"1 packets received\"`" ]; then
|
||||
configure_loopback $NEW_HOSTNAME
|
||||
fi
|
||||
|
||||
add_postmaster "$POST_USER" "$POST_NAME"
|
||||
add_alias "$POST_NAME" "$POST_USER"
|
||||
configure_trn "$POST_USER" "$POST_EDIT"
|
||||
configure_elm "$POST_USER" "$POST_EDIT"
|
||||
|
||||
comment_nntp_in_inetdconf
|
||||
set_organization "$NEW_ORIGIN"
|
||||
create_innconf_newsfeeds_distrib
|
||||
create_expirectl $KEEPDAYS
|
||||
create_nnrpaccess
|
||||
create_hostsnntp
|
||||
create_dirs_and_files
|
||||
install_rcnews
|
||||
install_crontab_news
|
||||
if [ $IFMAILTGZ ]; then
|
||||
install_ifmail "$IFMAILTGZ" /usr/lib/ifmail /etc/ifmail /var/log/ifmail "$IFMAILVERS" /usr/src
|
||||
fi
|
||||
configure_ifmail /usr/lib/ifmail /etc/ifmail /var/log/ifmail "$PASSW"
|
||||
configure_smail $SMAILCFGDIR
|
||||
|
||||
###############################################################################
|
||||
$DIALOG --backtitle "$TITLE" \
|
||||
--title "-=[ Enjoy! ]=-" --msgbox "Il point e' stato installato con successo!" 0 0 --and-widget \
|
||||
--msgbox "trn (il newsreader, per leggere/scrivere gli echomail) ed elm (il mailreader, per leggere/scrivere i netmail) sono gia' stati configurati per l'user $POST_USER." 0 0
|
||||
|
||||
popd >/dev/null
|
@ -1,28 +0,0 @@
|
||||
|
||||
Disk /dev/hda: 14 heads, 62 sectors, 1018 cylinders
|
||||
Units = cylinders of 868 * 512 bytes
|
||||
|
||||
Device Boot Begin Start End Blocks Id System
|
||||
/dev/hda1 1 1 3 1271 a OS/2 Boot Manager
|
||||
/dev/hda2 4 4 287 123256 6 DOS 16-bit >=32M
|
||||
/dev/hda3 * 288 288 649 157108 83 Linux native
|
||||
/dev/hda4 650 650 1018 160146 83 Linux native
|
||||
|
||||
Disk /dev/sda: 64 heads, 32 sectors, 511 cylinders
|
||||
Units = cylinders of 2048 * 512 bytes
|
||||
|
||||
Device Boot Begin Start End Blocks Id System
|
||||
/dev/sda1 1 1 21 21488 82 Linux swap
|
||||
/dev/sda2 22 22 511 501760 83 Linux native
|
||||
|
||||
Disk /dev/sdb: 64 heads, 32 sectors, 4106 cylinders
|
||||
Units = cylinders of 2048 * 512 bytes
|
||||
|
||||
Device Boot Begin Start End Blocks Id System
|
||||
/dev/sdb1 1 1 201 205808 83 Linux native
|
||||
/dev/sdb2 202 202 402 205824 83 Linux native
|
||||
/dev/sdb3 403 403 603 205824 83 Linux native
|
||||
/dev/sdb4 604 604 4106 3587072 5 Extended
|
||||
/dev/sdb5 604 604 1803 1228784 83 Linux native
|
||||
/dev/sdb6 1024 1804 3003 1228784 83 Linux native
|
||||
/dev/sdb7 2048 3004 4106 1129456 83 Linux native
|
@ -1,35 +0,0 @@
|
||||
# $Id: makefile.in,v 1.1 2000/10/08 17:22:53 tom Exp $
|
||||
# template makefile for DIALOG sample 'install'
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_builddir = ../..
|
||||
|
||||
DESTDIR =
|
||||
bindir = $(DESTDIR)@bindir@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@ @DEFS@ -I$(top_builddir) -I$(srcdir)/../.. -I. -I$(srcdir)
|
||||
EXTRA_CFLAGS = @EXTRA_CFLAGS@
|
||||
CC = @CC@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = -L../.. -ldialog @LIBS@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
RM = rm -f
|
||||
|
||||
all: setup
|
||||
|
||||
setup: setup.o
|
||||
$(CC) -o $@ setup.o $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f *.o setup
|
||||
|
||||
test: setup
|
||||
./setup
|
||||
|
@ -1,371 +0,0 @@
|
||||
/* Copyright (C) 1995 Florian La Roche */
|
||||
/* Who wants to help coding? I don't like doing this... */
|
||||
|
||||
/* You can just start setup as normal user and see how far it is coded
|
||||
right now. This will do a fake installation and won't actually chnage
|
||||
any data on your computer. */
|
||||
|
||||
/* TODO: write a good package selection code
|
||||
change functions to return better error code
|
||||
*/
|
||||
|
||||
/* Show an extra text-box with the contents of all external commands,
|
||||
before they are executed. So you can abort the installation, if any
|
||||
wrong commands are to be executed. (So don't format wrong partition.) */
|
||||
#define VERBOSE 1
|
||||
|
||||
/* If defined, don't actually execute any comands and don't actually modify
|
||||
any files. So you can test any possible installation without doing any
|
||||
damage to your computer.
|
||||
The file FDISK.TEST is used instead of real "fdisk -l" output, so that
|
||||
it can be started as normal user. */
|
||||
#define DEBUG_THIS 1
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
/* max length of a partition name like e.g. '/dev/hda1' */
|
||||
#define MAX_DEV_NAME 25
|
||||
|
||||
/* max number of possible Linux/Swap/MsDos partitions */
|
||||
#define MAX_PARTS 20
|
||||
|
||||
char *progname = NULL;
|
||||
|
||||
static void
|
||||
error(const char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: %s\n", progname, s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int
|
||||
my_system(const char *s,...)
|
||||
{
|
||||
int ret, i;
|
||||
va_list ap;
|
||||
char sh[200];
|
||||
|
||||
va_start(ap, s);
|
||||
vsprintf(sh, s, ap);
|
||||
va_end(ap);
|
||||
|
||||
#ifdef VERBOSE
|
||||
i = dialog_msgbox("I will run the following command:", sh, 10, 65, 1);
|
||||
dialog_clear();
|
||||
#ifdef DEBUG_THIS
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
ret = system(sh);
|
||||
if (!(ret >> 8))
|
||||
return 0;
|
||||
i = dialog_msgbox("Error-Exit on the following command:",
|
||||
sh, 12, 73, 1);
|
||||
dialog_clear();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* We support to install from DOS/Linux-partitions. */
|
||||
enum partition_type {
|
||||
MsDos,
|
||||
Linux,
|
||||
Swap
|
||||
};
|
||||
|
||||
struct partition {
|
||||
enum partition_type type;
|
||||
char name[MAX_DEV_NAME];
|
||||
int blocks;
|
||||
int flag;
|
||||
} partitions[MAX_PARTS];
|
||||
int num_partition = 0;
|
||||
int num_linux = 0;
|
||||
int num_swap = 0;
|
||||
int num_msdos = 0;
|
||||
|
||||
static int
|
||||
get_line(char *line, int size, FILE * f)
|
||||
{
|
||||
char *ptr = line;
|
||||
int c;
|
||||
|
||||
if (feof(f))
|
||||
return -1;
|
||||
while (size-- && ((c = getc(f)) != EOF) && (c != '\n'))
|
||||
*ptr++ = c;
|
||||
*ptr++ = '\0';
|
||||
return (int) (ptr - line);
|
||||
}
|
||||
|
||||
static void
|
||||
read_partitions(void)
|
||||
{
|
||||
FILE *f;
|
||||
char line[200];
|
||||
int length;
|
||||
#ifndef DEBUG_THIS
|
||||
int ret = system("fdisk -l 2>/dev/null 1>/tmp/fdisk.output");
|
||||
if ((ret >> 8) != 0) {
|
||||
error("fdisk didn't run");
|
||||
}
|
||||
if ((f = fopen("/tmp/fdisk.output", "r")) == NULL)
|
||||
#else
|
||||
if ((f = fopen("FDISK.TEST", "r")) == NULL)
|
||||
#endif
|
||||
error("cannot read fdisk output");
|
||||
|
||||
while (num_partition <= MAX_PARTS
|
||||
&& (length = get_line(line, 200, f)) >= 0) {
|
||||
if (strncmp(line, "/dev/", 5) == 0) {
|
||||
int n = 0;
|
||||
char *s = line + 5;
|
||||
char *t = partitions[num_partition].name;
|
||||
strcpy(t, "/dev/");
|
||||
t += 5;
|
||||
while (n < MAX_DEV_NAME && *s != '\0'
|
||||
&& !isspace((unsigned char) *s)) {
|
||||
*t++ = *s++;
|
||||
n++;
|
||||
}
|
||||
*t = '\0';
|
||||
/* Read the size of the partition. */
|
||||
t = line + 37;
|
||||
while (isspace((unsigned char) *t))
|
||||
t++;
|
||||
partitions[num_partition].blocks = atoi(t);
|
||||
if (strstr(line, "Linux native")) {
|
||||
partitions[num_partition].type = Linux;
|
||||
num_partition++;
|
||||
num_linux++;
|
||||
} else if (strstr(line, "Linux swap")) {
|
||||
partitions[num_partition].type = Swap;
|
||||
num_partition++;
|
||||
num_swap++;
|
||||
} else if (strstr(line, "DOS")) {
|
||||
partitions[num_partition].type = MsDos;
|
||||
num_partition++;
|
||||
num_msdos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
#ifndef DEBUG_THIS
|
||||
unlink("/tmp/fdisk.output");
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
select_partition(const char *title, const char *prompt, int y, int x)
|
||||
{
|
||||
int i, num, ret;
|
||||
char info[MAX_PARTS][40];
|
||||
char *items[MAX_PARTS * 2];
|
||||
int num_pa[MAX_PARTS];
|
||||
|
||||
num = 0;
|
||||
for (i = 0; i < num_partition; i++) {
|
||||
if (partitions[i].type == Linux) {
|
||||
items[num * 2] = partitions[i].name;
|
||||
sprintf(info[num], "Linux partition with %d blocks",
|
||||
partitions[i].blocks);
|
||||
items[num * 2 + 1] = info[num];
|
||||
num_pa[num] = i;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
ret = dialog_menu(title, prompt, y + num, x, num, num, items);
|
||||
dialog_clear();
|
||||
if (ret >= 0) /* item selected */
|
||||
ret = num_pa[ret];
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
select_install_partition(void)
|
||||
{
|
||||
return select_partition("Select Install Partition",
|
||||
"\\nWhere do you want to install Linux?\\n", 9, 60);
|
||||
}
|
||||
|
||||
static int
|
||||
select_source_partition(void)
|
||||
{
|
||||
return select_partition("Select Source Partition",
|
||||
"\\nOn which partition is the source?\\n", 9, 60);
|
||||
}
|
||||
|
||||
const char *null = ">/dev/null 2>/dev/null";
|
||||
const char *install_partition = NULL;
|
||||
|
||||
static void
|
||||
extract_packages(const char *source_path)
|
||||
{
|
||||
#ifndef DEBUG_THIS
|
||||
FILE *f;
|
||||
#endif
|
||||
|
||||
if (my_system("mkdir -p /install/var/installed/packages %s", null))
|
||||
return;
|
||||
if (my_system("cd /install; for i in /source%s/*.tgz; do "
|
||||
"tar xzplvvkf $i >> var/installed/packages/base "
|
||||
"2>>var/installed/packages/ERROR; done", source_path))
|
||||
return;
|
||||
#ifndef DEBUG_THIS
|
||||
if ((f = fopen("/install/etc/fstab", "w")) == NULL) {
|
||||
/* i = */ dialog_msgbox("Error", "Cannot write /etc/fstab",
|
||||
12, 40, 1);
|
||||
return;
|
||||
}
|
||||
fprintf(f, "%s / ext2 defaults 1 1\n", install_partition);
|
||||
fprintf(f, "none /proc proc defaults 0 2\n");
|
||||
/* XXX write swap-partitions */
|
||||
fclose(f);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
install_premounted(void)
|
||||
{
|
||||
extract_packages("");
|
||||
}
|
||||
|
||||
static void
|
||||
install_harddisk(void)
|
||||
{
|
||||
const char *name;
|
||||
int part, ret;
|
||||
|
||||
if ((part = select_source_partition()) <= -1)
|
||||
return;
|
||||
name = partitions[part].name;
|
||||
|
||||
if (my_system("mount -t ext2 %s /source %s", name, null))
|
||||
return;
|
||||
ret = dialog_inputbox("Path in partition",
|
||||
"Please enter the directory in which the "
|
||||
"source files are.", 13, 50, "", FALSE);
|
||||
dialog_clear();
|
||||
if (ret != 0)
|
||||
return;
|
||||
/* XXX strdup */
|
||||
extract_packages(strdup(dialog_input_result));
|
||||
if (my_system("umount /source %s", null))
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
install_nfs(void)
|
||||
{
|
||||
if (my_system("ifconfig eth0 134.96.81.36 netmask 255.255.255.224 "
|
||||
"broadcast 134.96.81.63 %s", null))
|
||||
return;
|
||||
if (my_system("route add -net 134.96.81.32 %s", null))
|
||||
return;
|
||||
if (my_system("mount -t nfs 134.96.81.38:"
|
||||
"/local/ftp/pub/linux/ELF.binary/tar /source %s", null))
|
||||
return;
|
||||
extract_packages("/base");
|
||||
if (my_system("umount /source %s", null))
|
||||
return;
|
||||
if (my_system("ifconfig eth0 down %s", null))
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
main_install(void)
|
||||
{
|
||||
int part, ret;
|
||||
const char *name;
|
||||
char *items1[] =
|
||||
{
|
||||
"1", "Harddisk Install",
|
||||
"2", "Network Install(NFS)",
|
||||
"3", "Premounted on /source"
|
||||
};
|
||||
|
||||
if (num_linux == 0) {
|
||||
/* XXX */
|
||||
return;
|
||||
}
|
||||
if ((part = select_install_partition()) <= -1)
|
||||
return;
|
||||
install_partition = name = partitions[part].name;
|
||||
if (my_system("mke2fs %s %s", name, null))
|
||||
return;
|
||||
if (my_system("mount -t ext2 %s /install %s", name, null))
|
||||
return;
|
||||
ret = dialog_menu("Choose install medium",
|
||||
"\\nPlease say from where you want to install.\\n",
|
||||
12, 62, 3, 3, items1);
|
||||
dialog_clear();
|
||||
switch (ret) {
|
||||
case 0:
|
||||
install_harddisk();
|
||||
break;
|
||||
case 1:
|
||||
install_nfs();
|
||||
break;
|
||||
case 2:
|
||||
install_premounted();
|
||||
break;
|
||||
case -2: /* cancel */
|
||||
case -1:
|
||||
break; /* esc */
|
||||
}
|
||||
if (my_system("umount /install %s", null))
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int stop = 0;
|
||||
int ret;
|
||||
char *items1[] =
|
||||
{
|
||||
"1", "Display a help text",
|
||||
"2", "Start an installation",
|
||||
"3", "Exit to the shell"
|
||||
};
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
read_partitions();
|
||||
if (num_linux == 0) {
|
||||
printf("\n\nPlease start \"fdisk\" or \"cfdisk\" and create a"
|
||||
"\nnative Linux-partition to install Linux on.\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_dialog();
|
||||
|
||||
while (!stop) {
|
||||
ret = dialog_menu("Linux Install Utility",
|
||||
"\\nCopyright (C) 1995 Florian La Roche\\n"
|
||||
"\\nPre-Alpha version, be careful, read the doc!!!"
|
||||
"\\nemail: florian@jurix.jura.uni-sb.de, "
|
||||
"flla@stud.uni-sb.de\\n",
|
||||
15, 64, 3, 3, items1);
|
||||
dialog_clear();
|
||||
switch (ret) {
|
||||
case 0:
|
||||
ret = dialog_textbox("Help Text",
|
||||
"setup.help", 20, 70);
|
||||
dialog_clear();
|
||||
break;
|
||||
case 1:
|
||||
main_install();
|
||||
break;
|
||||
case 2:
|
||||
stop = 1;
|
||||
break;
|
||||
case -2: /* cancel */
|
||||
case -1:
|
||||
stop = 1; /* esc */
|
||||
}
|
||||
}
|
||||
end_dialog();
|
||||
printf("\nExecute \"reboot\" to restart your computer...\n");
|
||||
|
||||
exit(0);
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
At the moment, only installation from a harddisk
|
||||
is supported. All commands are shown to you on
|
||||
the screen before executing. This is just to make
|
||||
sure that nothing bad is done to your harddisk :-)
|
||||
|
||||
You can also select to install from a premounted dir.
|
||||
Then the "tar/base" directory must be mounted on
|
||||
"/install", so that all tar-packages from the basic
|
||||
stuff are in "/install/*.tgz". (So you could be able
|
||||
to install via NFS...)
|
||||
|
||||
Good luck...,
|
||||
anyone wants to help programming this tool?,
|
||||
|
||||
Florian La Roche
|
||||
|
||||
Contents:
|
||||
=========
|
||||
- overview about what "setup" does.
|
||||
- creating a Linux-partition before starting "setup"
|
||||
- about lilo
|
||||
- how to use "setup", what keys are supported
|
||||
|
||||
What does "setup" do on my computer?
|
||||
====================================
|
||||
Setup will ask you for a partition on your harddisk,
|
||||
where you would like to have Linux installed.
|
||||
You can then choose to install this distribution from
|
||||
your local harddisk or via network (NFS).
|
||||
setup will install a very basic system.
|
||||
At the end, you can install lilo, the Linux Loader.
|
||||
Rebooting your computer with this little linux system
|
||||
and then runing the setup-program on it, will give
|
||||
the possibility to install more packages.
|
||||
|
||||
Creating a Linux-partition:
|
||||
===========================
|
||||
To install this Linux distribution, you need to
|
||||
create an extra partition on your harddisk for
|
||||
Linux.
|
||||
|
||||
What is lilo and how should I install it?
|
||||
=========================================
|
||||
Read the lilo-documentation for this...
|
||||
|
||||
|
||||
|
||||
Florian La Roche
|
||||
|
43
samples/menubox12
Executable file
43
samples/menubox12
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
# $Id: menubox12,v 1.3 2012/12/23 22:28:26 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
. ./setup-edit
|
||||
|
||||
case "x$DIALOGOPTS" in
|
||||
*--no-items*|*--noitem*)
|
||||
CUT="cut -d: -f1,3"
|
||||
;;
|
||||
*)
|
||||
CUT="cat"
|
||||
;;
|
||||
esac
|
||||
|
||||
$CUT >$input <<-EOF
|
||||
Linux:The Great Unix Clone for 386/486
|
||||
NetBSD:Another free Unix Clone for 386/486
|
||||
OS/2:IBM OS/2
|
||||
WIN NT:Microsoft Windows NT
|
||||
PCDOS:IBM PC DOS
|
||||
MSDOS:Microsoft DOS
|
||||
EOF
|
||||
cat $input | sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' >$output
|
||||
cat $output >$input
|
||||
|
||||
$DIALOG --clear --title "MENU BOX" "$@" \
|
||||
--menu "Hi, this is a menu box. You can use this to \n\
|
||||
present a list of choices for the user to \n\
|
||||
choose. If there are more items than can fit \n\
|
||||
on the screen, the menu will be scrolled. \n\
|
||||
You can use the UP/DOWN arrow keys, the first \n\
|
||||
letter of the choice as a hot key, or the \n\
|
||||
number keys 1-9 to choose an option.\n\
|
||||
Try it now!\n\n\
|
||||
Choose the OS you like:" 20 51 4 \
|
||||
--file $input 2> $output
|
||||
|
||||
retval=$?
|
||||
|
||||
tempfile=$output
|
||||
. ./report-tempfile
|
11
samples/rangebox
Executable file
11
samples/rangebox
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# $Id: rangebox,v 1.3 2012/12/05 10:07:54 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
exec 3>&1
|
||||
RESULT=`$DIALOG --title "RANGE BOX" --rangebox "Please set the volume..." 0 60 0 123 5 2>&1 1>&3`
|
||||
retval=$?
|
||||
exec 3>&-
|
||||
|
||||
. ./report-string
|
11
samples/rangebox2
Executable file
11
samples/rangebox2
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# $Id: rangebox2,v 1.1 2012/12/05 10:28:58 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
exec 3>&1
|
||||
RESULT=`$DIALOG --title "RANGE BOX" --rangebox "Please set the volume..." 0 60 0 6 5 2>&1 1>&3`
|
||||
retval=$?
|
||||
exec 3>&-
|
||||
|
||||
. ./report-string
|
11
samples/rangebox3
Executable file
11
samples/rangebox3
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# $Id: rangebox3,v 1.1 2012/12/05 10:19:42 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
exec 3>&1
|
||||
RESULT=`$DIALOG --title "RANGE BOX" --rangebox "Please set the volume..." 0 60 -48 55 5 2>&1 1>&3`
|
||||
retval=$?
|
||||
exec 3>&-
|
||||
|
||||
. ./report-string
|
11
samples/rangebox4
Executable file
11
samples/rangebox4
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# $Id: rangebox4,v 1.1 2012/12/05 11:54:04 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
exec 3>&1
|
||||
RESULT=`$DIALOG --title "RANGE BOX" --rangebox "Please set the volume..." 0 60 10 100 5 2>&1 1>&3`
|
||||
retval=$?
|
||||
exec 3>&-
|
||||
|
||||
. ./report-string
|
@ -1,4 +1,4 @@
|
||||
# $Id: slackware.rc,v 1.9 2011/10/15 01:00:25 tom Exp $
|
||||
# $Id: slackware.rc,v 1.10 2012/12/01 00:36:55 tom Exp $
|
||||
# vile:confmode
|
||||
# Run-time configuration file for dialog, matches Slackware color scheme.
|
||||
#
|
||||
@ -130,7 +130,7 @@ form_item_readonly_color = (CYAN,WHITE,ON)
|
||||
gauge_color = (BLUE,WHITE,ON)
|
||||
|
||||
# Dialog box border2 color
|
||||
border2_color = (BLACK,WHITE,OFF)
|
||||
border2_color = dialog_color
|
||||
|
||||
# Input box border2 color
|
||||
inputbox_border2_color = border2_color
|
||||
|
22
samples/treeview
Executable file
22
samples/treeview
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# $Id: treeview,v 1.2 2012/12/04 10:53:09 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
. ./setup-tempfile
|
||||
|
||||
$DIALOG --title "TREE VIEW DIALOG" \
|
||||
--treeview "TreeView demo" 0 0 0 \
|
||||
tag1 one off 0 \
|
||||
tag2 two off 1 \
|
||||
tag3 three on 2 \
|
||||
tag4 four off 1 \
|
||||
tag5 five off 2 \
|
||||
tag6 six off 3 \
|
||||
tag7 seven off 3 \
|
||||
tag8 eight off 4 \
|
||||
tag9 nine off 1 2> $tempfile
|
||||
|
||||
retval=$?
|
||||
|
||||
. ./report-tempfile
|
52
samples/treeview2
Executable file
52
samples/treeview2
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# $Id: treeview2,v 1.3 2012/12/23 22:28:00 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
. ./setup-edit
|
||||
|
||||
case "x$DIALOGOPTS" in
|
||||
*--no-items*|*--noitem*)
|
||||
CUT="cut -d: -f1,3,4"
|
||||
;;
|
||||
*)
|
||||
CUT="cat"
|
||||
;;
|
||||
esac
|
||||
|
||||
$CUT >$input <<-EOF
|
||||
tag1:one:off:0
|
||||
tag2:two:off:1
|
||||
tag3:three:on:2
|
||||
tag4:four:off:1
|
||||
tag5:five:off:2
|
||||
tag6:six:off:3
|
||||
tag7:seven:off:3
|
||||
tag8:eight:off:4
|
||||
tag11:1one:off:0
|
||||
tag12:1two:off:1
|
||||
tag13:1three:on:2
|
||||
tag14:1four:off:1
|
||||
tag15:1five:off:2
|
||||
tag16:1six:off:3
|
||||
tag17:1seven:off:3
|
||||
tag18:1eight:off:4
|
||||
tag21:2one:off:0
|
||||
tag22:2two:off:1
|
||||
tag23:2three:on:2
|
||||
tag24:2four:off:1
|
||||
tag25:2five:off:2
|
||||
tag26:2six:off:3
|
||||
tag27:2seven:off:3
|
||||
tag28:2eight:off:4
|
||||
tag9:nine:off:1
|
||||
EOF
|
||||
|
||||
$DIALOG --title "TREE VIEW DIALOG" \
|
||||
--scrollbar \
|
||||
--treeview "TreeView demo" 0 0 10 `cat $input | sed -e 's/:/ /g'` 2> $output
|
||||
|
||||
retval=$?
|
||||
|
||||
tempfile=$output
|
||||
. ./report-tempfile
|
@ -1,4 +1,4 @@
|
||||
# $Id: whiptail.rc,v 1.5 2011/10/15 01:01:16 tom Exp $
|
||||
# $Id: whiptail.rc,v 1.6 2012/12/01 01:15:04 tom Exp $
|
||||
# vile:confmode
|
||||
# Run-time configuration file for dialog, matches whiptail's color scheme.
|
||||
#
|
||||
@ -139,4 +139,4 @@ inputbox_border2_color = dialog_color
|
||||
searchbox_border2_color = dialog_color
|
||||
|
||||
# Menu box border2 color
|
||||
menubox_border2_color = dialog_color
|
||||
menubox_border2_color = screen_color
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: tailbox.c,v 1.67 2011/10/15 12:43:07 tom Exp $
|
||||
* $Id: tailbox.c,v 1.68 2012/11/18 15:48:52 tom Exp $
|
||||
*
|
||||
* tailbox.c -- implements the tail box
|
||||
*
|
||||
* Copyright 2000-2010,2011 Thomas E. Dickey
|
||||
* Copyright 2000-2011,2012 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
|
||||
@ -34,7 +34,7 @@ typedef struct {
|
||||
const char **buttons;
|
||||
int hscroll;
|
||||
int old_hscroll;
|
||||
char line[MAX_LEN + 1];
|
||||
char line[MAX_LEN + 2];
|
||||
off_t last_pos;
|
||||
} MY_OBJ;
|
||||
|
||||
|
62
textbox.c
62
textbox.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: textbox.c,v 1.107 2012/07/01 18:13:24 Zoltan.Kelemen Exp $
|
||||
* $Id: textbox.c,v 1.110 2012/12/01 01:48:08 tom Exp $
|
||||
*
|
||||
* textbox.c -- implements the text box
|
||||
*
|
||||
@ -55,6 +55,7 @@ lseek_obj(MY_OBJ * obj, long offset, int mode)
|
||||
long fpos;
|
||||
if ((fpos = (long) lseek(obj->fd, (off_t) offset, mode)) == -1) {
|
||||
switch (mode) {
|
||||
default:
|
||||
case SEEK_CUR:
|
||||
dlg_exiterr("Cannot get file position");
|
||||
break;
|
||||
@ -75,6 +76,37 @@ ftell_obj(MY_OBJ * obj)
|
||||
return lseek_obj(obj, 0L, SEEK_CUR);
|
||||
}
|
||||
|
||||
static void
|
||||
lseek_set(MY_OBJ * obj, long offset)
|
||||
{
|
||||
long actual = lseek_obj(obj, offset, SEEK_SET);
|
||||
|
||||
if (actual != offset) {
|
||||
dlg_exiterr("Cannot set file position to %ld (actual %ld)\n",
|
||||
offset, actual);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lseek_end(MY_OBJ * obj, long offset)
|
||||
{
|
||||
long actual = lseek_obj(obj, offset, SEEK_END);
|
||||
|
||||
if (actual > offset) {
|
||||
obj->file_size = actual;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lseek_cur(MY_OBJ * obj, long offset)
|
||||
{
|
||||
long actual = lseek_obj(obj, offset, SEEK_CUR);
|
||||
|
||||
if (actual != offset) {
|
||||
dlg_trace_msg("Lseek returned %ld, expected %ld\n", actual, offset);
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
xalloc(size_t size)
|
||||
{
|
||||
@ -197,7 +229,7 @@ tabize(MY_OBJ * obj, long val, long *first_pos)
|
||||
|
||||
fpos = ftell_obj(obj);
|
||||
|
||||
lseek_obj(obj, fpos - obj->fd_bytes_read, SEEK_SET);
|
||||
lseek_set(obj, fpos - obj->fd_bytes_read);
|
||||
|
||||
/* Allocate space for read buffer */
|
||||
buftab = xalloc((size_t) val + 1);
|
||||
@ -224,7 +256,7 @@ tabize(MY_OBJ * obj, long val, long *first_pos)
|
||||
count++;
|
||||
}
|
||||
|
||||
lseek_obj(obj, fpos, SEEK_SET);
|
||||
lseek_set(obj, fpos);
|
||||
free(buftab);
|
||||
return count;
|
||||
}
|
||||
@ -309,10 +341,10 @@ back_lines(MY_OBJ * obj, long n)
|
||||
/* Really possible to move backward BUF_SIZE/2 bytes? */
|
||||
if (fpos < BUF_SIZE / 2 + obj->fd_bytes_read) {
|
||||
/* No, move less than */
|
||||
lseek_obj(obj, 0L, SEEK_SET);
|
||||
lseek_set(obj, 0L);
|
||||
val_to_tabize = fpos - obj->fd_bytes_read;
|
||||
} else { /* Move backward BUF_SIZE/2 bytes */
|
||||
lseek_obj(obj, -(BUF_SIZE / 2 + obj->fd_bytes_read), SEEK_CUR);
|
||||
lseek_cur(obj, -(BUF_SIZE / 2 + obj->fd_bytes_read));
|
||||
val_to_tabize = BUF_SIZE / 2;
|
||||
}
|
||||
read_high(obj, BUF_SIZE);
|
||||
@ -340,10 +372,10 @@ back_lines(MY_OBJ * obj, long n)
|
||||
/* Really possible to move backward BUF_SIZE/2 bytes? */
|
||||
if (fpos < BUF_SIZE / 2 + obj->fd_bytes_read) {
|
||||
/* No, move less than */
|
||||
lseek_obj(obj, 0L, SEEK_SET);
|
||||
lseek_set(obj, 0L);
|
||||
val_to_tabize = fpos - obj->fd_bytes_read;
|
||||
} else { /* Move backward BUF_SIZE/2 bytes */
|
||||
lseek_obj(obj, -(BUF_SIZE / 2 + obj->fd_bytes_read), SEEK_CUR);
|
||||
lseek_cur(obj, -(BUF_SIZE / 2 + obj->fd_bytes_read));
|
||||
val_to_tabize = BUF_SIZE / 2;
|
||||
}
|
||||
read_high(obj, BUF_SIZE);
|
||||
@ -493,7 +525,7 @@ get_search_term(WINDOW *dialog, char *input, int height, int width)
|
||||
searchbox_attr,
|
||||
searchbox_border_attr,
|
||||
searchbox_border2_attr);
|
||||
wattrset(widget, searchbox_title_attr);
|
||||
(void) wattrset(widget, searchbox_title_attr);
|
||||
(void) wmove(widget, 0, (box_width - len_caption) / 2);
|
||||
|
||||
indx = dlg_index_wchars(caption);
|
||||
@ -567,7 +599,7 @@ perform_search(MY_OBJ * obj, int height, int width, int key, char *search_term)
|
||||
}
|
||||
#endif
|
||||
/* ESC pressed, or no search term, reprint page to clear box */
|
||||
wattrset(obj->text, dialog_attr);
|
||||
(void) wattrset(obj->text, dialog_attr);
|
||||
back_lines(obj, obj->page_length);
|
||||
return TRUE;
|
||||
}
|
||||
@ -596,7 +628,7 @@ perform_search(MY_OBJ * obj, int height, int width, int key, char *search_term)
|
||||
if (found == FALSE) { /* not found */
|
||||
(void) beep();
|
||||
/* Restore program state to that before searching */
|
||||
lseek_obj(obj, fpos, SEEK_SET);
|
||||
lseek_set(obj, fpos);
|
||||
|
||||
read_high(obj, BUF_SIZE);
|
||||
|
||||
@ -612,7 +644,7 @@ perform_search(MY_OBJ * obj, int height, int width, int key, char *search_term)
|
||||
back_lines(obj, 1L);
|
||||
}
|
||||
/* Reprint page */
|
||||
wattrset(obj->text, dialog_attr);
|
||||
(void) wattrset(obj->text, dialog_attr);
|
||||
moved = TRUE;
|
||||
} else { /* no need to find */
|
||||
(void) beep();
|
||||
@ -692,10 +724,10 @@ dialog_textbox(const char *title, const char *file, int height, int width)
|
||||
|
||||
/* Get file size. Actually, 'file_size' is the real file size - 1,
|
||||
since it's only the last byte offset from the beginning */
|
||||
obj.file_size = lseek_obj(&obj, 0L, SEEK_END);
|
||||
lseek_end(&obj, 0L);
|
||||
|
||||
/* Restore file pointer to beginning of file after getting file size */
|
||||
lseek_obj(&obj, 0L, SEEK_SET);
|
||||
lseek_set(&obj, 0L);
|
||||
|
||||
read_high(&obj, BUF_SIZE);
|
||||
|
||||
@ -833,7 +865,7 @@ dialog_textbox(const char *title, const char *file, int height, int width)
|
||||
|
||||
if (fpos > obj.fd_bytes_read) {
|
||||
/* Yes, we have to read it in */
|
||||
lseek_obj(&obj, 0L, SEEK_SET);
|
||||
lseek_set(&obj, 0L);
|
||||
|
||||
read_high(&obj, BUF_SIZE);
|
||||
}
|
||||
@ -848,7 +880,7 @@ dialog_textbox(const char *title, const char *file, int height, int width)
|
||||
|
||||
if (fpos < obj.file_size) {
|
||||
/* Yes, we have to read it in */
|
||||
lseek_obj(&obj, -BUF_SIZE, SEEK_END);
|
||||
lseek_end(&obj, -BUF_SIZE);
|
||||
|
||||
read_high(&obj, BUF_SIZE);
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: timebox.c,v 1.52 2012/07/02 09:34:04 tom Exp $
|
||||
* $Id: timebox.c,v 1.54 2013/03/17 15:03:41 tom Exp $
|
||||
*
|
||||
* timebox.c -- implements the timebox dialog
|
||||
*
|
||||
* Copyright 2001-2011,2012 Thomas E. Dickey
|
||||
* Copyright 2001-2012,2013 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
|
||||
@ -41,8 +41,6 @@ typedef enum {
|
||||
|
||||
struct _box;
|
||||
|
||||
typedef int (*BOX_DRAW) (struct _box *, struct tm *);
|
||||
|
||||
typedef struct _box {
|
||||
WINDOW *parent;
|
||||
WINDOW *window;
|
||||
@ -414,6 +412,7 @@ dialog_timebox(const char *title,
|
||||
|
||||
dlg_add_result(buffer);
|
||||
dlg_add_separator();
|
||||
dlg_add_last_key(-1);
|
||||
|
||||
return CleanupResult(result, dialog, prompt, &save_vars);
|
||||
}
|
||||
|
672
treeview.c
Normal file
672
treeview.c
Normal file
@ -0,0 +1,672 @@
|
||||
/*
|
||||
* $Id: treeview.c,v 1.22 2013/05/23 23:35:46 tom Exp $
|
||||
*
|
||||
* treeview.c -- implements the treeview dialog
|
||||
*
|
||||
* Copyright 2012,2013 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>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#define INDENT 3
|
||||
#define MIN_HIGH (1 + (5 * MARGIN))
|
||||
|
||||
typedef struct {
|
||||
/* the outer-window */
|
||||
WINDOW *dialog;
|
||||
bool is_check;
|
||||
int box_y;
|
||||
int box_x;
|
||||
int check_x;
|
||||
int item_x;
|
||||
int use_height;
|
||||
int use_width;
|
||||
/* the inner-window */
|
||||
WINDOW *list;
|
||||
DIALOG_LISTITEM *items;
|
||||
int item_no;
|
||||
int *depths;
|
||||
const char *states;
|
||||
} ALL_DATA;
|
||||
|
||||
/*
|
||||
* Print list item. The 'selected' parameter is true if 'choice' is the
|
||||
* current item. That one is colored differently from the other items.
|
||||
*/
|
||||
static void
|
||||
print_item(ALL_DATA * data,
|
||||
DIALOG_LISTITEM * item,
|
||||
const char *states,
|
||||
int depths,
|
||||
int choice,
|
||||
int selected)
|
||||
{
|
||||
WINDOW *win = data->list;
|
||||
chtype save = dlg_get_attrs(win);
|
||||
int i;
|
||||
bool first = TRUE;
|
||||
int climit = (getmaxx(win) - data->check_x + 1);
|
||||
const char *show = (dialog_vars.no_items
|
||||
? item->name
|
||||
: item->text);
|
||||
|
||||
/* Clear 'residue' of last item */
|
||||
(void) wattrset(win, menubox_attr);
|
||||
(void) wmove(win, choice, 0);
|
||||
for (i = 0; i < data->use_width; i++)
|
||||
(void) waddch(win, ' ');
|
||||
|
||||
(void) wmove(win, choice, data->check_x);
|
||||
(void) wattrset(win, selected ? check_selected_attr : check_attr);
|
||||
(void) wprintw(win,
|
||||
data->is_check ? "[%c]" : "(%c)",
|
||||
states[item->state]);
|
||||
(void) wattrset(win, menubox_attr);
|
||||
|
||||
(void) wattrset(win, selected ? item_selected_attr : item_attr);
|
||||
for (i = 0; i < depths; ++i) {
|
||||
int j;
|
||||
(void) wmove(win, choice, data->item_x + INDENT * i);
|
||||
(void) waddch(win, ACS_VLINE);
|
||||
for (j = INDENT - 1; j > 0; --j)
|
||||
(void) waddch(win, ' ');
|
||||
}
|
||||
(void) wmove(win, choice, data->item_x + INDENT * depths);
|
||||
|
||||
dlg_print_listitem(win, show, climit, first, selected);
|
||||
|
||||
if (selected) {
|
||||
dlg_item_help(item->help);
|
||||
}
|
||||
(void) wattrset(win, save);
|
||||
}
|
||||
|
||||
static void
|
||||
print_list(ALL_DATA * data,
|
||||
int choice,
|
||||
int scrollamt,
|
||||
int max_choice)
|
||||
{
|
||||
int i;
|
||||
int cur_y, cur_x;
|
||||
|
||||
getyx(data->dialog, cur_y, cur_x);
|
||||
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(data,
|
||||
&data->items[scrollamt + i],
|
||||
data->states,
|
||||
data->depths[scrollamt + i],
|
||||
i, i == choice);
|
||||
}
|
||||
(void) wnoutrefresh(data->list);
|
||||
|
||||
dlg_draw_scrollbar(data->dialog,
|
||||
(long) (scrollamt),
|
||||
(long) (scrollamt),
|
||||
(long) (scrollamt + max_choice),
|
||||
(long) (data->item_no),
|
||||
data->box_x + data->check_x,
|
||||
data->box_x + data->use_width,
|
||||
data->box_y,
|
||||
data->box_y + data->use_height + 1,
|
||||
menubox_border2_attr,
|
||||
menubox_border_attr);
|
||||
|
||||
(void) wmove(data->dialog, cur_y, cur_x);
|
||||
}
|
||||
|
||||
static bool
|
||||
check_hotkey(DIALOG_LISTITEM * items, int choice)
|
||||
{
|
||||
bool result = FALSE;
|
||||
|
||||
if (dlg_match_char(dlg_last_getc(),
|
||||
(dialog_vars.no_tags
|
||||
? items[choice].text
|
||||
: items[choice].name))) {
|
||||
result = TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an alternate interface to 'treeview' which allows the application
|
||||
* to read the list item states back directly without putting them in the
|
||||
* output buffer.
|
||||
*/
|
||||
int
|
||||
dlg_treeview(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int list_height,
|
||||
int item_no,
|
||||
DIALOG_LISTITEM * items,
|
||||
const char *states,
|
||||
int *depths,
|
||||
int flag,
|
||||
int *current_item)
|
||||
{
|
||||
/* *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 ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_FIRST, KEY_HOME ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_LAST, KEY_END ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_LAST, KEY_LL ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, '+' ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_DOWN ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, CHR_NEXT ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, '-' ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, KEY_UP ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, CHR_PREVIOUS ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, DLGK_MOUSE(KEY_NPAGE) ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, DLGK_MOUSE(KEY_PPAGE) ),
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
ALL_DATA all;
|
||||
int i, j, key2, found, x, y, cur_y, box_x, box_y;
|
||||
int key = 0, fkey;
|
||||
int button = dialog_state.visit_items ? -1 : dlg_default_button();
|
||||
int choice = dlg_default_listitem(items);
|
||||
int scrollamt = 0;
|
||||
int max_choice;
|
||||
int was_mouse;
|
||||
int use_height;
|
||||
int use_width, name_width, text_width, tree_width;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int num_states;
|
||||
WINDOW *dialog, *list;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
const char *widget_name;
|
||||
|
||||
/* we need at least two states */
|
||||
if (states == 0 || strlen(states) < 2)
|
||||
states = " *";
|
||||
num_states = (int) strlen(states);
|
||||
|
||||
memset(&all, 0, sizeof(all));
|
||||
all.items = items;
|
||||
all.item_no = item_no;
|
||||
all.states = states;
|
||||
all.depths = depths;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
all.is_check = TRUE;
|
||||
}
|
||||
widget_name = "treeview";
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
|
||||
use_height = list_height;
|
||||
use_width = dlg_calc_list_width(item_no, items) + 10;
|
||||
use_width = MAX(26, use_width);
|
||||
if (use_height == 0) {
|
||||
/* calculate height without items (4) */
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, use_width);
|
||||
dlg_calc_listh(&height, &use_height, item_no);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, use_width);
|
||||
}
|
||||
dlg_button_layout(buttons, &width);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
dlg_register_window(dialog, widget_name, binding);
|
||||
dlg_register_buttons(dialog, widget_name, buttons);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr);
|
||||
dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
(void) wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
all.use_width = width - 4;
|
||||
cur_y = getcury(dialog);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - all.use_width) / 2 - 1;
|
||||
|
||||
/*
|
||||
* After displaying the prompt, we know how much space we really have.
|
||||
* Limit the list to avoid overwriting the ok-button.
|
||||
*/
|
||||
if (use_height + MIN_HIGH > height - cur_y)
|
||||
use_height = height - MIN_HIGH - cur_y;
|
||||
if (use_height <= 0)
|
||||
use_height = 1;
|
||||
|
||||
max_choice = MIN(use_height, item_no);
|
||||
|
||||
/* create new window for the list */
|
||||
list = dlg_sub_window(dialog, use_height, all.use_width,
|
||||
y + box_y + 1, x + box_x + 1);
|
||||
|
||||
/* draw a box around the list items */
|
||||
dlg_draw_box(dialog, box_y, box_x,
|
||||
use_height + 2 * MARGIN,
|
||||
all.use_width + 2 * MARGIN,
|
||||
menubox_border_attr, menubox_border2_attr);
|
||||
|
||||
text_width = 0;
|
||||
name_width = 0;
|
||||
tree_width = 0;
|
||||
/* Find length of longest item to center treeview */
|
||||
for (i = 0; i < item_no; i++) {
|
||||
tree_width = MAX(tree_width, INDENT * depths[i]);
|
||||
text_width = MAX(text_width, dlg_count_columns(items[i].text));
|
||||
name_width = MAX(name_width, dlg_count_columns(items[i].name));
|
||||
}
|
||||
if (dialog_vars.no_tags && !dialog_vars.no_items) {
|
||||
tree_width += text_width;
|
||||
} else if (dialog_vars.no_items) {
|
||||
tree_width += name_width;
|
||||
} else {
|
||||
tree_width += (text_width + name_width);
|
||||
}
|
||||
|
||||
use_width = (all.use_width - 4);
|
||||
tree_width = MIN(tree_width, all.use_width);
|
||||
|
||||
all.check_x = (use_width - tree_width) / 2;
|
||||
all.item_x = ((dialog_vars.no_tags
|
||||
? 0
|
||||
: (dialog_vars.no_items
|
||||
? 0
|
||||
: (2 + name_width)))
|
||||
+ all.check_x + 4);
|
||||
|
||||
/* ensure we are scrolled to show the current choice */
|
||||
if (choice >= (max_choice + scrollamt)) {
|
||||
scrollamt = choice - max_choice + 1;
|
||||
choice = max_choice - 1;
|
||||
}
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(box_y + 1, box_x,
|
||||
use_height, all.use_width + 2,
|
||||
KEY_MAX, 1, 1, 1 /* by lines */ );
|
||||
|
||||
all.dialog = dialog;
|
||||
all.box_x = box_x;
|
||||
all.box_y = box_y;
|
||||
all.use_height = use_height;
|
||||
all.list = list;
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
|
||||
dlg_trace_win(dialog);
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
if (button < 0) /* --visit-items */
|
||||
wmove(dialog, box_y + choice + 1, box_x + all.check_x + 2);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
|
||||
was_mouse = (fkey && is_DLGK_MOUSE(key));
|
||||
if (was_mouse)
|
||||
key -= M_EVENT;
|
||||
|
||||
if (was_mouse && (key >= KEY_MAX)) {
|
||||
i = (key - KEY_MAX);
|
||||
if (i < max_choice) {
|
||||
choice = (key - KEY_MAX);
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
|
||||
key = ' '; /* force the selected item to toggle */
|
||||
} else {
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
fkey = FALSE;
|
||||
} else if (was_mouse && key >= KEY_MIN) {
|
||||
key = dlg_lookup_key(dialog, key, &fkey);
|
||||
}
|
||||
|
||||
/*
|
||||
* A space toggles the item status.
|
||||
*/
|
||||
if (key == ' ') {
|
||||
int current = scrollamt + choice;
|
||||
int next = items[current].state + 1;
|
||||
|
||||
if (next >= num_states)
|
||||
next = 0;
|
||||
|
||||
if (flag == FLAG_CHECK) { /* checklist? */
|
||||
items[current].state = next;
|
||||
} else {
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (i != current) {
|
||||
items[i].state = 0;
|
||||
}
|
||||
}
|
||||
if (items[current].state) {
|
||||
items[current].state = next ? next : 1;
|
||||
} else {
|
||||
items[current].state = 1;
|
||||
}
|
||||
}
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if key pressed matches first character of any item tag in
|
||||
* list. If there is more than one match, we will cycle through
|
||||
* each one as the same key is pressed repeatedly.
|
||||
*/
|
||||
found = FALSE;
|
||||
if (!fkey) {
|
||||
if (button < 0 || !dialog_state.visit_items) {
|
||||
for (j = scrollamt + choice + 1; j < item_no; j++) {
|
||||
if (check_hotkey(items, j)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (j = 0; j <= scrollamt + choice; j++) {
|
||||
if (check_hotkey(items, j)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
dlg_flush_getc();
|
||||
} else if ((j = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
button = j;
|
||||
ungetch('\n');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A single digit (1-9) positions the selection to that line in the
|
||||
* current screen.
|
||||
*/
|
||||
if (!found
|
||||
&& (key <= '9')
|
||||
&& (key > '0')
|
||||
&& (key - '1' < max_choice)) {
|
||||
found = TRUE;
|
||||
i = key - '1';
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (fkey) {
|
||||
found = TRUE;
|
||||
switch (key) {
|
||||
case DLGK_ITEM_FIRST:
|
||||
i = -scrollamt;
|
||||
break;
|
||||
case DLGK_ITEM_LAST:
|
||||
i = item_no - 1 - scrollamt;
|
||||
break;
|
||||
case DLGK_PAGE_PREV:
|
||||
if (choice)
|
||||
i = 0;
|
||||
else if (scrollamt != 0)
|
||||
i = -MIN(scrollamt, max_choice);
|
||||
else
|
||||
continue;
|
||||
break;
|
||||
case DLGK_PAGE_NEXT:
|
||||
i = MIN(choice + max_choice, item_no - scrollamt - 1);
|
||||
break;
|
||||
case DLGK_ITEM_PREV:
|
||||
i = choice - 1;
|
||||
if (choice == 0 && scrollamt == 0)
|
||||
continue;
|
||||
break;
|
||||
case DLGK_ITEM_NEXT:
|
||||
i = choice + 1;
|
||||
if (scrollamt + choice >= item_no - 1)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
found = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (i != choice) {
|
||||
if (i < 0 || i >= max_choice) {
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
} else {
|
||||
choice = i;
|
||||
print_list(&all, choice, scrollamt, max_choice);
|
||||
}
|
||||
}
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case DLGK_ENTER:
|
||||
result = dlg_enter_buttoncode(button);
|
||||
break;
|
||||
case DLGK_FIELD_PREV:
|
||||
button = dlg_prev_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case DLGK_FIELD_NEXT:
|
||||
button = dlg_next_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
default:
|
||||
if (was_mouse) {
|
||||
if ((key2 = dlg_ok_buttoncode(key)) >= 0) {
|
||||
result = key2;
|
||||
break;
|
||||
}
|
||||
beep();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free(prompt);
|
||||
*current_item = (scrollamt + choice);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a set of items as a tree.
|
||||
*/
|
||||
int
|
||||
dialog_treeview(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int list_height,
|
||||
int item_no,
|
||||
char **items,
|
||||
int flag)
|
||||
{
|
||||
int result;
|
||||
int i, j;
|
||||
DIALOG_LISTITEM *listitems;
|
||||
int *depths;
|
||||
bool show_status = FALSE;
|
||||
int current = 0;
|
||||
|
||||
listitems = dlg_calloc(DIALOG_LISTITEM, (size_t) item_no + 1);
|
||||
assert_ptr(listitems, "dialog_treeview");
|
||||
|
||||
depths = dlg_calloc(int, (size_t) item_no + 1);
|
||||
assert_ptr(depths, "dialog_treeview");
|
||||
|
||||
for (i = j = 0; i < item_no; ++i) {
|
||||
listitems[i].name = items[j++];
|
||||
listitems[i].text = (dialog_vars.no_items
|
||||
? dlg_strempty()
|
||||
: items[j++]);
|
||||
listitems[i].state = !dlg_strcmp(items[j++], "on");
|
||||
depths[i] = atoi(items[j++]);
|
||||
listitems[i].help = ((dialog_vars.item_help)
|
||||
? items[j++]
|
||||
: dlg_strempty());
|
||||
}
|
||||
dlg_align_columns(&listitems[0].text, (int) sizeof(DIALOG_LISTITEM), item_no);
|
||||
|
||||
result = dlg_treeview(title,
|
||||
cprompt,
|
||||
height,
|
||||
width,
|
||||
list_height,
|
||||
item_no,
|
||||
listitems,
|
||||
NULL,
|
||||
depths,
|
||||
flag,
|
||||
¤t);
|
||||
|
||||
switch (result) {
|
||||
case DLG_EXIT_OK: /* FALLTHRU */
|
||||
case DLG_EXIT_EXTRA:
|
||||
show_status = TRUE;
|
||||
break;
|
||||
case DLG_EXIT_HELP:
|
||||
dlg_add_result("HELP ");
|
||||
show_status = dialog_vars.help_status;
|
||||
if (USE_ITEM_HELP(listitems[current].help)) {
|
||||
if (show_status) {
|
||||
if (dialog_vars.separate_output) {
|
||||
dlg_add_string(listitems[current].help);
|
||||
dlg_add_separator();
|
||||
} else {
|
||||
dlg_add_quoted(listitems[current].help);
|
||||
}
|
||||
} else {
|
||||
dlg_add_string(listitems[current].help);
|
||||
}
|
||||
result = DLG_EXIT_ITEM_HELP;
|
||||
} else {
|
||||
if (show_status) {
|
||||
if (dialog_vars.separate_output) {
|
||||
dlg_add_string(listitems[current].name);
|
||||
dlg_add_separator();
|
||||
} else {
|
||||
dlg_add_quoted(listitems[current].name);
|
||||
}
|
||||
} else {
|
||||
dlg_add_string(listitems[current].name);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (show_status) {
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (listitems[i].state) {
|
||||
if (dialog_vars.separate_output) {
|
||||
dlg_add_string(listitems[i].name);
|
||||
dlg_add_separator();
|
||||
} else {
|
||||
if (dlg_need_separator())
|
||||
dlg_add_separator();
|
||||
if (flag == FLAG_CHECK)
|
||||
dlg_add_quoted(listitems[i].name);
|
||||
else
|
||||
dlg_add_string(listitems[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
dlg_add_last_key(-1);
|
||||
}
|
||||
|
||||
dlg_free_columns(&listitems[0].text, (int) sizeof(DIALOG_LISTITEM), item_no);
|
||||
free(depths);
|
||||
free(listitems);
|
||||
return result;
|
||||
}
|
43
ui_getc.c
43
ui_getc.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: ui_getc.c,v 1.65 2011/10/20 23:45:48 tom Exp $
|
||||
* $Id: ui_getc.c,v 1.67 2013/03/24 23:53:19 tom Exp $
|
||||
*
|
||||
* ui_getc.c - user interface glue for getc()
|
||||
*
|
||||
* Copyright 2001-2010,2011 Thomas E. Dickey
|
||||
* Copyright 2001-2012,2013 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
|
||||
@ -283,6 +283,36 @@ dlg_flush_getc(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Report the last key entered by the user. The 'mode' parameter controls
|
||||
* the way it is separated from other results:
|
||||
* -2 (no separator)
|
||||
* -1 (separator after the key name)
|
||||
* 0 (separator is optionally before the key name)
|
||||
* 1 (same as -1)
|
||||
*/
|
||||
void
|
||||
dlg_add_last_key(int mode)
|
||||
{
|
||||
if (dialog_vars.last_key) {
|
||||
if (mode >= 0) {
|
||||
if (mode > 0) {
|
||||
dlg_add_last_key(-1);
|
||||
} else {
|
||||
if (dlg_need_separator())
|
||||
dlg_add_separator();
|
||||
dlg_add_last_key(-2);
|
||||
}
|
||||
} else {
|
||||
char temp[80];
|
||||
sprintf(temp, "%d", last_getc);
|
||||
dlg_add_string(temp);
|
||||
if (mode == -1)
|
||||
dlg_add_separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the stream has been unexpectedly closed, returning false in that
|
||||
* case.
|
||||
@ -440,12 +470,9 @@ dlg_getc(WINDOW *win, int *fkey)
|
||||
if (!*fkey || *fkey != before_fkey) {
|
||||
switch (ch) {
|
||||
case CHR_LITERAL:
|
||||
if (!literal) {
|
||||
literal = TRUE;
|
||||
keypad(win, FALSE);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
literal = TRUE;
|
||||
keypad(win, FALSE);
|
||||
continue;
|
||||
case CHR_REPAINT:
|
||||
(void) touchwin(win);
|
||||
(void) wrefresh(curscr);
|
||||
|
163
util.c
163
util.c
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* $Id: util.c,v 1.243 2012/06/30 12:58:04 tom Exp $
|
||||
* $Id: util.c,v 1.255 2013/05/23 22:58:28 tom Exp $
|
||||
*
|
||||
* util.c -- miscellaneous utilities for dialog
|
||||
*
|
||||
* Copyright 2000-2011,2012 Thomas E. Dickey
|
||||
* Copyright 2000-2012,2013 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
|
||||
@ -193,7 +193,7 @@ dlg_put_backtitle(void)
|
||||
chtype attr = A_NORMAL;
|
||||
int backwidth = dlg_count_columns(dialog_vars.backtitle);
|
||||
|
||||
wattrset(stdscr, screen_attr);
|
||||
(void) wattrset(stdscr, screen_attr);
|
||||
(void) wmove(stdscr, 0, 1);
|
||||
dlg_print_text(stdscr, dialog_vars.backtitle, COLS - 2, &attr);
|
||||
for (i = 0; i < COLS - backwidth; i++)
|
||||
@ -215,7 +215,7 @@ dlg_attr_clear(WINDOW *win, int height, int width, chtype attr)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
wattrset(win, attr);
|
||||
(void) wattrset(win, attr);
|
||||
for (i = 0; i < height; i++) {
|
||||
(void) wmove(win, i, 0);
|
||||
for (j = 0; j < width; j++)
|
||||
@ -271,6 +271,18 @@ open_terminal(char **result, int mode)
|
||||
return open(device, mode);
|
||||
}
|
||||
|
||||
#ifdef NCURSES_VERSION
|
||||
static int
|
||||
my_putc(int ch)
|
||||
{
|
||||
char buffer[2];
|
||||
int fd = fileno(dialog_state.screen_output);
|
||||
|
||||
buffer[0] = (char) ch;
|
||||
return (int) write(fd, buffer, (size_t) 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Do some initialization for dialog.
|
||||
*
|
||||
@ -315,22 +327,26 @@ init_dialog(FILE *input, FILE *output)
|
||||
*/
|
||||
dialog_state.pipe_input = stdin;
|
||||
if (fileno(input) != fileno(stdin)) {
|
||||
if (dup(fileno(input)) >= 0
|
||||
if ((fd1 = dup(fileno(input))) >= 0
|
||||
&& (fd2 = dup(fileno(stdin))) >= 0) {
|
||||
(void) dup2(fileno(input), fileno(stdin));
|
||||
dialog_state.pipe_input = fdopen(fd2, "r");
|
||||
if (fileno(stdin) != 0) /* some functions may read fd #0 */
|
||||
(void) dup2(fileno(stdin), 0);
|
||||
} else
|
||||
} else {
|
||||
dlg_exiterr("cannot open tty-input");
|
||||
}
|
||||
close(fd1);
|
||||
} else if (!isatty(fileno(stdin))) {
|
||||
if (open_terminal(&device, O_RDONLY) >= 0
|
||||
&& (fd2 = dup(fileno(stdin))) >= 0) {
|
||||
dialog_state.pipe_input = fdopen(fd2, "r");
|
||||
if (freopen(device, "r", stdin) == 0)
|
||||
dlg_exiterr("cannot open tty-input");
|
||||
if (fileno(stdin) != 0) /* some functions may read fd #0 */
|
||||
(void) dup2(fileno(stdin), 0);
|
||||
if ((fd1 = open_terminal(&device, O_RDONLY)) >= 0) {
|
||||
if ((fd2 = dup(fileno(stdin))) >= 0) {
|
||||
dialog_state.pipe_input = fdopen(fd2, "r");
|
||||
if (freopen(device, "r", stdin) == 0)
|
||||
dlg_exiterr("cannot open tty-input");
|
||||
if (fileno(stdin) != 0) /* some functions may read fd #0 */
|
||||
(void) dup2(fileno(stdin), 0);
|
||||
}
|
||||
close(fd1);
|
||||
}
|
||||
free(device);
|
||||
}
|
||||
@ -373,19 +389,20 @@ init_dialog(FILE *input, FILE *output)
|
||||
* Cancel xterm's alternate-screen mode.
|
||||
*/
|
||||
if (!dialog_vars.keep_tite
|
||||
&& (dialog_state.screen_output != stdout
|
||||
&& (fileno(dialog_state.screen_output) != fileno(stdout)
|
||||
|| isatty(fileno(dialog_state.screen_output)))
|
||||
&& key_mouse != 0 /* xterm and kindred */
|
||||
&& isprivate(enter_ca_mode)
|
||||
&& isprivate(exit_ca_mode)) {
|
||||
/*
|
||||
* initscr() or newterm() already did putp(enter_ca_mode) as a side
|
||||
* initscr() or newterm() already wrote enter_ca_mode as a side
|
||||
* effect of initializing the screen. It would be nice to not even
|
||||
* do that, but we do not really have access to the correct copy of
|
||||
* the terminfo description until those functions have been invoked.
|
||||
*/
|
||||
(void) putp(exit_ca_mode);
|
||||
(void) putp(clear_screen);
|
||||
(void) refresh();
|
||||
(void) tputs(exit_ca_mode, 0, my_putc);
|
||||
(void) tputs(clear_screen, 0, my_putc);
|
||||
/*
|
||||
* Prevent ncurses from switching "back" to the normal screen when
|
||||
* exiting from dialog. That would move the cursor to the original
|
||||
@ -628,6 +645,58 @@ is_combining(const char *txt, int *combined)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Print the name (tag) or text from a DIALOG_LISTITEM, highlighting the
|
||||
* first character if selected.
|
||||
*/
|
||||
void
|
||||
dlg_print_listitem(WINDOW *win,
|
||||
const char *text,
|
||||
int climit,
|
||||
bool first,
|
||||
int selected)
|
||||
{
|
||||
chtype attr = A_NORMAL;
|
||||
int limit;
|
||||
const int *cols;
|
||||
chtype attrs[4];
|
||||
|
||||
if (text == 0)
|
||||
text = "";
|
||||
|
||||
if (first) {
|
||||
const int *indx = dlg_index_wchars(text);
|
||||
attrs[3] = tag_key_selected_attr;
|
||||
attrs[2] = tag_key_attr;
|
||||
attrs[1] = tag_selected_attr;
|
||||
attrs[0] = tag_attr;
|
||||
|
||||
(void) wattrset(win, selected ? attrs[3] : attrs[2]);
|
||||
(void) waddnstr(win, text, indx[1]);
|
||||
|
||||
if ((int) strlen(text) > indx[1]) {
|
||||
limit = dlg_limit_columns(text, climit, 1);
|
||||
if (limit > 1) {
|
||||
(void) wattrset(win, selected ? attrs[1] : attrs[0]);
|
||||
(void) waddnstr(win,
|
||||
text + indx[1],
|
||||
indx[limit] - indx[1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
attrs[1] = item_selected_attr;
|
||||
attrs[0] = item_attr;
|
||||
|
||||
cols = dlg_index_columns(text);
|
||||
limit = dlg_limit_columns(text, climit, 0);
|
||||
|
||||
if (limit > 0) {
|
||||
(void) wattrset(win, selected ? attrs[1] : attrs[0]);
|
||||
dlg_print_text(win, text, cols[limit], &attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print up to 'cols' columns from 'text', optionally rendering our escape
|
||||
* sequence for attributes and color.
|
||||
@ -751,8 +820,8 @@ dlg_print_line(WINDOW *win,
|
||||
const char *prompt,
|
||||
int lm, int rm, int *x)
|
||||
{
|
||||
const char *wrap_ptr = prompt;
|
||||
const char *test_ptr = prompt;
|
||||
const char *wrap_ptr;
|
||||
const char *test_ptr;
|
||||
const char *hide_ptr = 0;
|
||||
const int *cols = dlg_index_columns(prompt);
|
||||
const int *indx = dlg_index_wchars(prompt);
|
||||
@ -977,12 +1046,12 @@ dlg_print_scrolled(WINDOW *win,
|
||||
#endif
|
||||
dummy = newwin(high, width, 0, 0);
|
||||
if (dummy == 0) {
|
||||
wattrset(win, dialog_attr);
|
||||
(void) 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);
|
||||
(void) wattrset(dummy, dialog_attr);
|
||||
werase(dummy);
|
||||
dlg_print_autowrap(dummy, prompt, high, width);
|
||||
getyx(dummy, y, x);
|
||||
@ -1013,7 +1082,7 @@ dlg_print_scrolled(WINDOW *win,
|
||||
(void) sprintf(buffer, "%d%%", percent);
|
||||
(void) waddstr(win, buffer);
|
||||
if ((len = (int) strlen(buffer)) < 4) {
|
||||
wattrset(win, border_attr);
|
||||
(void) wattrset(win, border_attr);
|
||||
whline(win, dlg_boxchar(ACS_HLINE), 4 - len);
|
||||
}
|
||||
}
|
||||
@ -1024,7 +1093,7 @@ dlg_print_scrolled(WINDOW *win,
|
||||
#endif
|
||||
{
|
||||
(void) offset;
|
||||
wattrset(win, dialog_attr);
|
||||
(void) wattrset(win, dialog_attr);
|
||||
dlg_print_autowrap(win, prompt, height + 1 + (3 * MARGIN), width);
|
||||
last = 0;
|
||||
}
|
||||
@ -1355,7 +1424,7 @@ dlg_draw_box2(WINDOW *win, int y, int x, int height, int width,
|
||||
int i, j;
|
||||
chtype save = dlg_get_attrs(win);
|
||||
|
||||
wattrset(win, 0);
|
||||
(void) wattrset(win, 0);
|
||||
for (i = 0; i < height; i++) {
|
||||
(void) wmove(win, y + i, x);
|
||||
for (j = 0; j < width; j++)
|
||||
@ -1378,7 +1447,7 @@ dlg_draw_box2(WINDOW *win, int y, int x, int height, int width,
|
||||
else
|
||||
(void) waddch(win, boxchar | ' ');
|
||||
}
|
||||
wattrset(win, save);
|
||||
(void) wattrset(win, save);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1541,7 +1610,7 @@ repaint_shadow(DIALOG_WINDOWS * dw, bool draw, int y, int x, int height, int wid
|
||||
if (UseShadow(dw)) {
|
||||
#if !USE_WCHGAT
|
||||
chtype save = dlg_get_attrs(dw->shadow);
|
||||
wattrset(dw->shadow, draw ? shadow_attr : screen_attr);
|
||||
(void) wattrset(dw->shadow, draw ? shadow_attr : screen_attr);
|
||||
#endif
|
||||
for (i = 0; i < SHADOW_ROWS; ++i) {
|
||||
for (j = 0; j < width; ++j) {
|
||||
@ -1555,7 +1624,7 @@ repaint_shadow(DIALOG_WINDOWS * dw, bool draw, int y, int x, int height, int wid
|
||||
}
|
||||
(void) wnoutrefresh(dw->shadow);
|
||||
#if !USE_WCHGAT
|
||||
wattrset(dw->shadow, save);
|
||||
(void) wattrset(dw->shadow, save);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1797,11 +1866,26 @@ int
|
||||
dlg_calc_list_width(int item_no, DIALOG_LISTITEM * items)
|
||||
{
|
||||
int n, i, len1 = 0, len2 = 0;
|
||||
int bits = ((dialog_vars.no_tags ? 1 : 0)
|
||||
+ (dialog_vars.no_items ? 2 : 0));
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
if ((n = dlg_count_columns(items[i].name)) > len1)
|
||||
len1 = n;
|
||||
if ((n = dlg_count_columns(items[i].text)) > len2)
|
||||
len2 = n;
|
||||
switch (bits) {
|
||||
case 0:
|
||||
/* FALLTHRU */
|
||||
case 1:
|
||||
if ((n = dlg_count_columns(items[i].name)) > len1)
|
||||
len1 = n;
|
||||
if ((n = dlg_count_columns(items[i].text)) > len2)
|
||||
len2 = n;
|
||||
break;
|
||||
case 2:
|
||||
/* FALLTHRU */
|
||||
case 3:
|
||||
if ((n = dlg_count_columns(items[i].name)) > len1)
|
||||
len1 = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return len1 + len2;
|
||||
}
|
||||
@ -1901,10 +1985,10 @@ dlg_draw_title(WINDOW *win, const char *title)
|
||||
chtype save = dlg_get_attrs(win);
|
||||
int x = centered(getmaxx(win), title);
|
||||
|
||||
wattrset(win, title_attr);
|
||||
(void) wattrset(win, title_attr);
|
||||
wmove(win, 0, x);
|
||||
dlg_print_text(win, title, getmaxx(win) - x, &attr);
|
||||
wattrset(win, save);
|
||||
(void) wattrset(win, save);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1915,14 +1999,14 @@ dlg_draw_bottom_box2(WINDOW *win, chtype on_left, chtype on_right, chtype on_ins
|
||||
int height = getmaxy(win);
|
||||
int i;
|
||||
|
||||
wattrset(win, on_left);
|
||||
(void) wattrset(win, on_left);
|
||||
(void) wmove(win, height - 3, 0);
|
||||
(void) waddch(win, dlg_boxchar(ACS_LTEE));
|
||||
for (i = 0; i < width - 2; i++)
|
||||
(void) waddch(win, dlg_boxchar(ACS_HLINE));
|
||||
wattrset(win, on_right);
|
||||
(void) wattrset(win, on_right);
|
||||
(void) waddch(win, dlg_boxchar(ACS_RTEE));
|
||||
wattrset(win, on_inside);
|
||||
(void) wattrset(win, on_inside);
|
||||
(void) wmove(win, height - 2, 1);
|
||||
for (i = 0; i < width - 2; i++)
|
||||
(void) waddch(win, ' ');
|
||||
@ -1980,8 +2064,8 @@ dlg_del_window(WINDOW *win)
|
||||
if (dialog_state.all_windows != 0)
|
||||
erase_childs_shadow(q);
|
||||
del_subwindows(q->normal);
|
||||
delwin(q->normal);
|
||||
dlg_unregister_window(q->normal);
|
||||
delwin(q->normal);
|
||||
free(q);
|
||||
}
|
||||
doupdate();
|
||||
@ -2007,7 +2091,8 @@ dlg_new_modal_window(WINDOW *parent, int height, int width, int y, int x)
|
||||
DIALOG_WINDOWS *p = dlg_calloc(DIALOG_WINDOWS, 1);
|
||||
|
||||
(void) parent;
|
||||
if ((win = newwin(height, width, y, x)) == 0) {
|
||||
if (p == 0
|
||||
|| (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);
|
||||
}
|
||||
@ -2123,7 +2208,7 @@ dlg_item_help(const char *txt)
|
||||
chtype attr = A_NORMAL;
|
||||
int y, x;
|
||||
|
||||
wattrset(stdscr, itemhelp_attr);
|
||||
(void) wattrset(stdscr, itemhelp_attr);
|
||||
(void) wmove(stdscr, LINES - 1, 0);
|
||||
(void) wclrtoeol(stdscr);
|
||||
(void) addch(' ');
|
||||
|
4
yesno.c
4
yesno.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: yesno.c,v 1.56 2012/07/02 23:58:08 tom Exp $
|
||||
* $Id: yesno.c,v 1.57 2012/12/01 01:48:21 tom Exp $
|
||||
*
|
||||
* yesno.c -- implements the yes/no box
|
||||
*
|
||||
@ -86,7 +86,7 @@ dialog_yesno(const char *title, const char *cprompt, int height, int width)
|
||||
dlg_draw_title(dialog, title);
|
||||
dlg_draw_helpline(dialog, FALSE);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
(void) wattrset(dialog, dialog_attr);
|
||||
|
||||
page = height - (1 + 3 * MARGIN);
|
||||
dlg_draw_buttons(dialog,
|
||||
|
Loading…
Reference in New Issue
Block a user