diff options
author | dgp <dgp@users.sourceforge.net> | 2005-07-23 04:12:46 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-07-23 04:12:46 (GMT) |
commit | 7bc20e13c9c5f3706c7f50ae52ff329de08f8782 (patch) | |
tree | 4d2d9275d5243ea9e69abc3b325fce1875cda4bd /library/safe.tcl | |
parent | 6f173b7f6fa783afed059c46c49241bebb0995b7 (diff) | |
download | tcl-7bc20e13c9c5f3706c7f50ae52ff329de08f8782.zip tcl-7bc20e13c9c5f3706c7f50ae52ff329de08f8782.tar.gz tcl-7bc20e13c9c5f3706c7f50ae52ff329de08f8782.tar.bz2 |
* library/auto.tcl: Updates to the Tcl script library to make
* library/history.tcl: use of Tcl 8.4 features. Forward port of
* library/init.tcl: appropriate portions of [Patch 1237755].
* library/package.tcl:
* library/safe.tcl:
* library/word.tcl:
Diffstat (limited to 'library/safe.tcl')
-rw-r--r-- | library/safe.tcl | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/library/safe.tcl b/library/safe.tcl index 60687bf..61246e8 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: safe.tcl,v 1.14 2004/06/29 09:34:44 dkf Exp $ +# RCS: @(#) $Id: safe.tcl,v 1.15 2005/07/23 04:12:49 dgp Exp $ # # The implementation is based on namespaces. These naming conventions @@ -77,7 +77,7 @@ namespace eval ::safe { upvar $v $v } set flag [::tcl::OptProcArgGiven -noStatics]; - if {$flag && ($noStatics == $statics) + if {$flag && (!$noStatics == !$statics) && ([::tcl::OptProcArgGiven -statics])} { return -code error\ "conflicting values given for -statics and -noStatics" @@ -98,7 +98,7 @@ namespace eval ::safe { set flag [::tcl::OptProcArgGiven -nestedLoadOk]; # note that the test here is the opposite of the "InterpStatics" # one (it is not -noNested... because of the wanted default value) - if {$flag && ($nestedLoadOk != $nested) + if {$flag && (!$nestedLoadOk != !$nested) && ([::tcl::OptProcArgGiven -nested])} { return -code error\ "conflicting values given for -nested and -nestedLoadOk" @@ -324,7 +324,7 @@ namespace eval ::safe { nestedok deletehook} { # determine and store the access path if empty - if {[string equal "" $access_path]} { + if {$access_path eq ""} { set access_path [uplevel \#0 set auto_path] # Make sure that tcl_library is in auto_path # and at the first position (needed by setAccessPath) @@ -764,7 +764,7 @@ proc ::safe::setLogCmd {args} { # Determine where to load. load use a relative interp path # and {} means self, so we can directly and safely use passed arg. set target [lindex $args 1] - if {[string length $target]} { + if {$target ne ""} { # we will try to load into a sub sub interp # check that we want to authorize that. if {![NestedOk $slave]} { @@ -776,9 +776,9 @@ proc ::safe::setLogCmd {args} { } # Determine what kind of load is requested - if {[string length $file] == 0} { + if {$file eq ""} { # static package loading - if {[string length $package] == 0} { + if {$package eq ""} { set msg "load error: empty filename and no package name" Log $slave $msg return -code error $msg @@ -846,7 +846,7 @@ proc ::safe::setLogCmd {args} { proc Subset {slave command okpat args} { set subcommand [lindex $args 0] if {[regexp $okpat $subcommand]} { - return [$command $subcommand {expand}[lrange $args 1 end]] + return [$command {expand}$args] } set msg "not allowed to invoke subcommand $subcommand of $command" Log $slave $msg @@ -881,11 +881,10 @@ proc ::safe::setLogCmd {args} { set subcommand [lindex $args 0] if {[regexp $okpat $subcommand]} { - return [::interp invokehidden $slave encoding $subcommand \ - {expand}[lrange $args 1 end]] + return [::interp invokehidden $slave encoding {expand}$args] } - if {[string match $subcommand system]} { + if {[string first $subcommand system] == 0} { if {$argc == 1} { # passed all the tests , lets source it: if {[catch {::interp invokehidden \ |