- }
-}
-
-add_help_text help "Tcl implementation of help command"
-
-
-#a bit of backwards compatibility
-proc openocd_throw {cmd} {
- set openocd_output ""
- eval $cmd
- return $openocd_output
-}
-
-#a bit of backwards compatibility
-proc openocd {cmd} {
- set openocd_output ""
- eval $cmd
- return $openocd_output
-}
-
-# If a fn is unknown to Tcl, we try to execute it as an OpenOCD command
-#
-# We also support two level commands. "flash banks" is translated to
-# flash_banks
-proc unknown {args} {
- # 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]"]
- }
- # This really is an unknown command.
- puts "Unknown command: $args"
-}
-
-
-proc target_script {target_num eventname scriptname} {
- if {[string compare $eventname reset]==0} {
- set eventname post_reset
- }
-
- # This is the script we invoke
- proc "target_[set eventname]_[set target_num]" {} "script $scriptname"
-
+ } else {if {$type == "group"} {
+ catch {eval ocd_usage $name $args}
+ set errmsg [format "%s: command requires more arguments" \
+ [concat $name " " $args]]
+ } else {
+ set errmsg [format "Unknown command type: %s" $type]
+ }}}
+ return -code error $errmsg