Add default procedure to make defining default values easier

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@25 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
Landon Fuller
2002-08-01 07:42:18 +00:00
parent 1cedf84c53
commit bc4123f2d2
+9
View File
@@ -38,6 +38,15 @@ proc options {array args} {
}
}
# default
# Checks if variable is set, if not, sets to supplied value
proc default {array key val} {
upvar $array uparray
if {![isval $array $key]} {
setval $array $key $val
}
}
# globals
# Specifies which keys from an array should be exported as global variables.
# Often used directly with options procedure