|
From: oharboe at B. <oh...@ma...> - 2009-05-18 15:07:38
|
Author: oharboe
Date: 2009-05-18 15:07:37 +0200 (Mon, 18 May 2009)
New Revision: 1810
Modified:
trunk/src/helper/startup.tcl
Log:
less weird error messages for unknown commands. Check if command exists before trying it.
Modified: trunk/src/helper/startup.tcl
===================================================================
--- trunk/src/helper/startup.tcl 2009-05-18 07:10:48 UTC (rev 1809)
+++ trunk/src/helper/startup.tcl 2009-05-18 13:07:37 UTC (rev 1810)
@@ -88,9 +88,10 @@
# do the name mangling from "flash banks" to "flash_banks"
if {[llength $args]>=2} {
set cmd_name "[lindex $args 0]_[lindex $args 1]"
- # Fix?? add a check here if this is a command?
- # we'll strip away args until we fail anyway...
- return [eval "$cmd_name [lrange $args 2 end]"]
+ if {[catch {info body $cmd_name}]==0} {
+ # the command exists, try it...
+ return [eval "$cmd_name [lrange $args 2 end]"]
+ }
}
# This really is an unknown command.
return -code error "Unknown command: $args"
|