Deleted Added
full compact
dialog.subr (256361) dialog.subr (258420)
1if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1
2#
3# Copyright (c) 2006-2013 Devin Teske
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 10 unchanged lines hidden (view full) ---

19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
1if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1
2#
3# Copyright (c) 2006-2013 Devin Teske
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 10 unchanged lines hidden (view full) ---

19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27# $FreeBSD: stable/10/usr.sbin/bsdconfig/share/dialog.subr 256361 2013-10-11 23:12:05Z dteske $
27# $FreeBSD: stable/10/usr.sbin/bsdconfig/share/dialog.subr 258420 2013-11-21 03:38:47Z dteske $
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." dialog.subr
34f_include $BSDCFG_SHARE/strings.subr
35f_include $BSDCFG_SHARE/variable.subr

--- 260 unchanged lines hidden (view full) ---

296#
297f_dialog_max_size()
298{
299 local __var_height="$1" __var_width="$2" __max_size
300 [ "$__var_height" -o "$__var_width" ] || return $FAILURE
301 if [ "$USE_XDIALOG" ]; then
302 __max_size="$XDIALOG_MAXSIZE" # see CONFIGURATION
303 else
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." dialog.subr
34f_include $BSDCFG_SHARE/strings.subr
35f_include $BSDCFG_SHARE/variable.subr

--- 260 unchanged lines hidden (view full) ---

296#
297f_dialog_max_size()
298{
299 local __var_height="$1" __var_width="$2" __max_size
300 [ "$__var_height" -o "$__var_width" ] || return $FAILURE
301 if [ "$USE_XDIALOG" ]; then
302 __max_size="$XDIALOG_MAXSIZE" # see CONFIGURATION
303 else
304 __max_size=$( stty size 2> /dev/null ) # usually "24 80"
304 if __max_size=$( $DIALOG --print-maxsize \
305 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD )
306 then
307 # usually "MaxSize: 24, 80"
308 __max_size="${__max_size#*: }"
309 f_replaceall "$__max_size" "," "" __max_size
310 else
311 __max_size=$( stty size 2> /dev/null )
312 # usually "24 80"
313 fi
305 : ${__max_size:=$DEFAULT_TERMINAL_SIZE}
306 fi
307 if [ "$__var_height" ]; then
308 local __height="${__max_size%%[$IFS]*}"
309 #
310 # If we're not using Xdialog(1), we should assume that $DIALOG
311 # will render --backtitle behind the widget. In such a case, we
312 # should prevent a widget from obscuring the backtitle (unless

--- 200 unchanged lines hidden (view full) ---

513 # Adjust rows if desired
514 if [ "$__var_rows" ]; then
515 if [ "$USE_XDIALOG" ]; then
516 : ${__min_rows:=1}
517 else
518 : ${__min_rows:=0}
519 fi
520
314 : ${__max_size:=$DEFAULT_TERMINAL_SIZE}
315 fi
316 if [ "$__var_height" ]; then
317 local __height="${__max_size%%[$IFS]*}"
318 #
319 # If we're not using Xdialog(1), we should assume that $DIALOG
320 # will render --backtitle behind the widget. In such a case, we
321 # should prevent a widget from obscuring the backtitle (unless

--- 200 unchanged lines hidden (view full) ---

522 # Adjust rows if desired
523 if [ "$__var_rows" ]; then
524 if [ "$USE_XDIALOG" ]; then
525 : ${__min_rows:=1}
526 else
527 : ${__min_rows:=0}
528 fi
529
521 local __max_rows=$(( $__max_height_menu_constrain - 8 ))
530 local __max_rows=$(( $__max_height_menu_constrain - 7 ))
522 # If prompt_len is zero (no prompt), bump the max-rows by 1
523 # Default assumption is (if no argument) that there's no prompt
524 [ ${__prompt_len:-0} -gt 0 ] ||
525 __max_rows=$(( $__max_rows + 1 ))
526
527 if [ $__rows -lt $__min_rows ]; then
528 setvar "$__var_rows" $__min_rows
529 elif [ $__rows -gt $__max_rows ]; then

--- 1675 unchanged lines hidden ---
531 # If prompt_len is zero (no prompt), bump the max-rows by 1
532 # Default assumption is (if no argument) that there's no prompt
533 [ ${__prompt_len:-0} -gt 0 ] ||
534 __max_rows=$(( $__max_rows + 1 ))
535
536 if [ $__rows -lt $__min_rows ]; then
537 setvar "$__var_rows" $__min_rows
538 elif [ $__rows -gt $__max_rows ]; then

--- 1675 unchanged lines hidden ---