From owner-svn-ports-all@FreeBSD.ORG Sat Sep 1 02:56:50 2012 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE76D1065670; Sat, 1 Sep 2012 02:56:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98FD38FC15; Sat, 1 Sep 2012 02:56:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q812uowK037981; Sat, 1 Sep 2012 02:56:50 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q812uo66037976; Sat, 1 Sep 2012 02:56:50 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209010256.q812uo66037976@svn.freebsd.org> From: Eitan Adler Date: Sat, 1 Sep 2012 02:56:50 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r303457 - in head/Tools/scripts: . dialogwrapper X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 02:56:50 -0000 Author: eadler Date: Sat Sep 1 02:56:50 2012 New Revision: 303457 URL: http://svn.freebsd.org/changeset/ports/303457 Log: By request, move dialogwrapper to the main folder and fix the readme. Additionally, document the wrapper in the main readme Added: head/Tools/scripts/dialogwrapper.sh - copied unchanged from r303448, head/Tools/scripts/dialogwrapper/dialogwrapper.sh head/Tools/scripts/dialogwrapper.txt - copied, changed from r303448, head/Tools/scripts/dialogwrapper/readme.txt Deleted: head/Tools/scripts/dialogwrapper/ Modified: head/Tools/scripts/README Modified: head/Tools/scripts/README ============================================================================== --- head/Tools/scripts/README Sat Sep 1 02:52:46 2012 (r303456) +++ head/Tools/scripts/README Sat Sep 1 02:56:50 2012 (r303457) @@ -19,6 +19,8 @@ chkorigin.sh - checks all ports in the t close-pr - a slightly hacked version of edit-pr(1) to quickly close PR. de-pkg-comment - converts pkg-comment to COMMENT (will be obsoleted when the mass conversion is finished) +dialogwrapper.sh - a wrapper for dialog(1) which provides extra features + and compatability distclean - compare md5 sums of distfiles in ports/distfiles with currently installed ports collection in ports/* and prompt to remove unmatched entries Copied: head/Tools/scripts/dialogwrapper.sh (from r303448, head/Tools/scripts/dialogwrapper/dialogwrapper.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/Tools/scripts/dialogwrapper.sh Sat Sep 1 02:56:50 2012 (r303457, copy of r303448, head/Tools/scripts/dialogwrapper/dialogwrapper.sh) @@ -0,0 +1,77 @@ +#!/bin/sh + +# $FreeBSD$ + +# dialog wrapper script + +AWK="/usr/bin/awk" +DIALOG="/usr/bin/dialog" +ECHO="/bin/echo" +SED="/usr/bin/sed" +STTY="/bin/stty" + +# get terminal size +size=$( ${STTY} size ) +visheight="${size%%[$IFS]*}" +visheight=$(($visheight-3)) +listheight=$(($visheight-6)) +viswidth="${size#*[$IFS]}" +viswidth=$(($viswidth-10)) +descwidth=$(($viswidth-22)) + +# test for a minimum version of dialog(1) +DIALOG_VER="0" +DIALOG_MIN="1.1-20100428" +dialogout=$( ${DIALOG} --print-version 2>&1 ) +if [ $? -eq 0 ]; then + DIALOG_VER=$( ${ECHO} "$dialogout" | ${SED} -e 's/^[^0-9]*//' ) + # only newer versions of dialog have --item-help + HAS_ITEM_HELP="1" +fi + +# escape the menu title +TITLE=$( ${AWK} -v title="$2" \ + 'BEGIN { gsub(/'\''/, "'\''\\'\'\''", title); print title }' ) + +cmdstr="" +[ "${HAS_ITEM_HELP}" ] && cmdstr="--item-help" +cmdstr="$cmdstr $1 '$2' $visheight $viswidth $listheight" +shift 5 + +menulist=$( + varlist= + _maxvarlen=0 + while [ $# -gt 0 ]; do + var="$1" + [ ${#var} -gt $_maxvarlen ] && export _maxvarlen=${#var} + varlist="$varlist${varlist:+ +}$var" + # build hashed environment variables + export _${var}_desc="$2" + export _${var}_val="$3" + shift 3 + done + ${ECHO} "$varlist" \ + | ${AWK} -v hasitemhelp="${HAS_ITEM_HELP}" -v viswid="$viswidth" ' + { + var = $1 + desc = ENVIRON["_" var "_desc"] + val = ENVIRON["_" var "_val"] + descwid = viswid -(ENVIRON["_maxvarlen"] + 12) + extdesc = "" + if ( length(desc) > descwid ) { + extdesc = substr(desc, descwid) + gsub(/'\''/, "'\''\\'\'\''", extdesc) + desc = substr(desc, 1, descwid - 1) "+" + } + gsub(/'\''/, "'\''\\'\'\''", desc) + printf "'\''%s'\'' '\''%s'\'' '\''%s'\''", var, desc, val + if ( hasitemhelp ) printf " '\''%s'\''", extdesc + printf "\n" + } ' +) + +eval ${DIALOG} $cmdstr $menulist +status="$?" +echo +exit $status Copied and modified: head/Tools/scripts/dialogwrapper.txt (from r303448, head/Tools/scripts/dialogwrapper/readme.txt) ============================================================================== --- head/Tools/scripts/dialogwrapper/readme.txt Fri Aug 31 22:36:00 2012 (r303448, copy source) +++ head/Tools/scripts/dialogwrapper.txt Sat Sep 1 02:56:50 2012 (r303457) @@ -29,17 +29,11 @@ more features: Installation -Download http://www.wonkity.com/~wblock/dialogwrapper/dialogwrapper.sh -to /usr/ports/Tools/scripts. - -Make it executable. - Edit /etc/make.conf: DIALOG="/usr/ports/Tools/scripts/dialogwrapper.sh" - Testing long descriptions Open a terminal window and resize it, making it narrower than the @@ -65,8 +59,6 @@ Open a terminal window and resize it, ma # cd /usr/ports/print/ghostscript9 # make config - - Work remaining to be done Cleanup of the code and additional comments.