diff --git a/ca b/ca index 31d3f06..f049bb8 100755 --- a/ca +++ b/ca @@ -1,7 +1,10 @@ #!/usr/bin/tclsh -# $Id: ca,v 1.7 2003/04/07 09:19:57 zimoch Exp $ +# $Id: ca,v 1.8 2003/04/10 12:53:36 zimoch Exp $ # $Source: /cvs/G/EPICS/App/scripts/ca,v $ # $Log: ca,v $ +# Revision 1.8 2003/04/10 12:53:36 zimoch +# added -hex flag +# # Revision 1.7 2003/04/07 09:19:57 zimoch # added exitstatus and some flags # @@ -16,6 +19,11 @@ # # +regsub -all {\$} {ca* by Dirk Zimoch +$Source: /cvs/G/EPICS/App/scripts/ca,v $ +$Revision: 1.8 $ +$Date: 2003/04/10 12:53:36 $} {} version + set auto_path [concat $env(SLSBASE)/lib/tcl $auto_path] package require Epics @@ -34,15 +42,12 @@ while {[string match "-*" [lindex $argv 0]]} { set argv [lrange $argv 1 end] } -if {[lsearch -regexp $flags {-(v(er(sion)?)?)}] != -1} { - puts "ca* by Dirk Zimoch" - puts [string trim {$Source: /cvs/G/EPICS/App/scripts/ca,v $} $] - puts [string trim {$Revision: 1.7 $} $] - puts [string trim {$Date: 2003/04/07 09:19:57 $} $] +if {[lsearch -regexp $flags {(v(er(sion)?)?)$}] != -1} { + puts $version exit } -if {[lsearch -regexp $flags {-(\?)|(h(elp)?)}] != -1 || [llength $argv] == 0} { +if {[lsearch -regexp $flags {(\?)|(h(elp)?)$}] != -1 || [llength $argv] == 0} { puts {usage: caget [flags] [ ...]} puts { caput [flags] [ ...]} puts { cainfo [flags] [ ...]} @@ -66,6 +71,7 @@ if {[lsearch -regexp $flags {-(\?)|(h(elp)?)}] != -1 || [llength $argv] == 0} { puts {-nounit don't add units} puts {-stat always add severity/status} puts {-nostat never add severity/status} + puts {-hex show integer values as hex} puts {-version print version and exit} puts {-help print this help text and exit} exit @@ -93,7 +99,13 @@ proc formatval {channel {value {}} {sevr {}} {stat {}} {time {}}} { set sevr $SEVR set time $TIME } - if [info exists PREC] { + if {[lsearch $flags -hex] != -1 && + [lsearch {DBF_CHAR DBF_SHORT DBF_LONG} $TYPE] != -1} { + foreach val $value { + lappend formatted [format "0x%x" $val] + } + set value [list $formatted] + } elseif [info exists PREC] { foreach val $value { if {$PREC < 0} { lappend formatted [format "%.[expr -$PREC]e" $val]