From owner-svn-src-head@FreeBSD.ORG Thu Nov 7 10:23:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B7C3E9E7; Thu, 7 Nov 2013 10:23:38 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8C0412F4D; Thu, 7 Nov 2013 10:23:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA7ANcdq028975; Thu, 7 Nov 2013 10:23:38 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA7ANcMn028972; Thu, 7 Nov 2013 10:23:38 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201311071023.rA7ANcMn028972@svn.freebsd.org> From: Devin Teske Date: Thu, 7 Nov 2013 10:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257783 - in head/usr.sbin/bsdconfig: include share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2013 10:23:38 -0000 Author: dteske Date: Thu Nov 7 10:23:37 2013 New Revision: 257783 URL: http://svnweb.freebsd.org/changeset/base/257783 Log: Add an f_show_err() function -- acts pretty much the same as f_show_msg() except it stylizes the msgbox widget to indicate an Error has occurred by setting an appropriate title and default message. Modified: head/usr.sbin/bsdconfig/include/messages.subr head/usr.sbin/bsdconfig/share/common.subr Modified: head/usr.sbin/bsdconfig/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/include/messages.subr Thu Nov 7 10:20:19 2013 (r257782) +++ head/usr.sbin/bsdconfig/include/messages.subr Thu Nov 7 10:23:37 2013 (r257783) @@ -40,6 +40,7 @@ msg_afterstep_desc="Ports to support the msg_all="All" msg_all_desc="All available packages in all categories." msg_always_try_sudo_when_run_as="Always try sudo(8) when run as %s" +msg_an_unknown_error_occurred="An unknown error occurred" msg_arabic_desc="Ported software for Arab countries." msg_archivers_desc="Utilities for archiving and unarchiving data." msg_armenia="Armenia" Modified: head/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/common.subr Thu Nov 7 10:20:19 2013 (r257782) +++ head/usr.sbin/bsdconfig/share/common.subr Thu Nov 7 10:23:37 2013 (r257783) @@ -358,6 +358,30 @@ f_show_msg() fi } +# f_show_err $format [$arguments ...] +# +# Display a message in a dialog box with ``Error'' i18n title (overridden by +# setting msg_error) using printf(1) syntax. If running non-interactively, +# the process will terminate (using [above] f_die()). +# +f_show_err() +{ + [ "$nonInteractive" ] && f_die + + local msg + msg=$( printf "$@" ) + + : ${msg:=${msg_an_unknown_error_occurred:-An unknown error occurred}} + + if [ "$_DIALOG_SUBR" ]; then + f_dialog_title "${msg_error:-Error}" + f_dialog_msgbox "$msg" + f_dialog_title_restore + else + dialog --title "${msg_error:-Error}" --msgbox "$msg" 0 0 + fi + return $SUCCESS +} # f_yesno $format [$arguments ...] #