svn commit: r257785 - head/usr.sbin/bsdconfig/share

Devin Teske dteske at FreeBSD.org
Thu Nov 7 10:30:20 UTC 2013


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


More information about the svn-src-all mailing list