diff options
Diffstat (limited to 'library/init.tcl')
-rw-r--r-- | library/init.tcl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/library/init.tcl b/library/init.tcl index b1d2b09..b669d6a 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -3,7 +3,7 @@ # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # -# RCS: @(#) $Id: init.tcl,v 1.55.2.2 2003/09/23 04:49:12 dgp Exp $ +# RCS: @(#) $Id: init.tcl,v 1.55.2.3 2004/05/03 14:28:59 dgp Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -295,13 +295,22 @@ proc unknown args { return [uplevel 1 $newcmd] } - set ret [catch {set cmds [info commands $name*]} msg] + set ret [catch {set candidates [info commands $name*]} msg] if {[string equal $name "::"]} { set name "" } if {$ret != 0} { return -code $ret -errorcode $errorCode \ - "error in unknown while checking if \"$name\" is a unique command abbreviation: $msg" + "error in unknown while checking if \"$name\" is\ + a unique command abbreviation:\n$msg" + } + # Filter out bogus matches when $name contained + # a glob-special char [Bug 946952] + set cmds [list] + foreach x $candidates { + if {[string range $x 0 [expr [string length $name]-1]] eq $name} { + lappend cmds $x + } } if {[llength $cmds] == 1} { return [uplevel 1 [lreplace $args 0 0 $cmds]] |