Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 May 2013 03:57:45 +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: r250317 - in head/usr.sbin/bsdconfig: share startup
Message-ID:  <201305070357.r473vjZH011311@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Tue May  7 03:57:45 2013
New Revision: 250317
URL: http://svnweb.freebsd.org/changeset/base/250317

Log:
  Add f_isset() utility subroutine for checking if a variable is set but in
  a more readable fashion.

Modified:
  head/usr.sbin/bsdconfig/share/common.subr
  head/usr.sbin/bsdconfig/startup/rcdelete

Modified: head/usr.sbin/bsdconfig/share/common.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/common.subr	Tue May  7 02:05:00 2013	(r250316)
+++ head/usr.sbin/bsdconfig/share/common.subr	Tue May  7 03:57:45 2013	(r250317)
@@ -195,6 +195,16 @@ f_getvar()
 	return $__retval
 }
 
+# f_isset $var
+#
+# Check if variable $var is set. Returns success if variable is set, otherwise
+# returns failure.
+#
+f_isset()
+{
+	eval [ \"\${${1%%[$IFS]*}+set}\" ]
+}
+
 # f_die [ $status [ $fmt [ $opts ... ]]]
 #
 # Abruptly terminate due to an error optionally displaying a message in a

Modified: head/usr.sbin/bsdconfig/startup/rcdelete
==============================================================================
--- head/usr.sbin/bsdconfig/startup/rcdelete	Tue May  7 02:05:00 2013	(r250316)
+++ head/usr.sbin/bsdconfig/startup/rcdelete	Tue May  7 03:57:45 2013	(r250317)
@@ -388,7 +388,7 @@ while :; do
 		var="${mtag# }"
 
 		# Toggle the state-variable and loop back to menu
-		if eval [ \"\${_${var}_delete+set}\" ]; then
+		if f_isset _${var}_delete; then
 			unset _${var}_delete
 		else
 			setvar _${var}_delete 1



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