Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Nov 2013 10:30:20 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257785 - head/usr.sbin/bsdconfig/share
Message-ID:  <201311071030.rA7AUKli031496@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Thu Nov  7 10:30:20 2013
New Revision: 257785
URL: http://svnweb.freebsd.org/changeset/base/257785

Log:
  Use dialog(1) to obtain maximum-size; stty fails when running in a pipe-
  chain. This allows dialogs to reach full size even when executed as an
  rvalue operand to a pipe (e.g., cat file | bsdconfig -f-).

Modified:
  head/usr.sbin/bsdconfig/share/dialog.subr

Modified: head/usr.sbin/bsdconfig/share/dialog.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/dialog.subr	Thu Nov  7 10:28:12 2013	(r257784)
+++ head/usr.sbin/bsdconfig/share/dialog.subr	Thu Nov  7 10:30:20 2013	(r257785)
@@ -301,7 +301,16 @@ f_dialog_max_size()
 	if [ "$USE_XDIALOG" ]; then
 		__max_size="$XDIALOG_MAXSIZE" # see CONFIGURATION
 	else
-		__max_size=$( stty size 2> /dev/null ) # usually "24 80"
+		if __max_size=$( $DIALOG --print-maxsize \
+			2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD )
+		then
+			# usually "MaxSize: 24, 80"
+			__max_size="${__max_size#*: }"
+			f_replaceall "$__max_size" "," "" __max_size
+		else
+			__max_size=$( stty size 2> /dev/null )
+			# usually "24 80"
+		fi
 		: ${__max_size:=$DEFAULT_TERMINAL_SIZE}
 	fi
 	if [ "$__var_height" ]; then



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311071030.rA7AUKli031496>