Committed.

The _ trick to handle two level commands, e.g. "flash banks", no longer
causes weird error messages w/"_" appearing.

Example of new error message:

> flash nosupported s adsfads asf saf
Unknown command: flash nosupported s adsfads asf saf
called at file "command.c", line 453


### Eclipse Workspace Patch 1.0
#P openocd
Index: src/helper/startup.tcl
===================================================================
--- src/helper/startup.tcl      (revision 1793)
+++ src/helper/startup.tcl      (working copy)
@@ -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"


-- 
Øyvind Harboe
Embedded software and hardware consulting services
http://consulting.zylin.com
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to