diff --git a/ca b/ca index 7b4e21a..3f7f388 100755 --- a/ca +++ b/ca @@ -2,12 +2,12 @@ # ca* by Dirk Zimoch # $Source: /cvs/G/EPICS/App/scripts/ca,v $ -# $Date: 2011/12/20 16:18:26 $ +# $Date: 2013/04/15 12:10:40 $ regsub -all {\$} {ca* by Dirk Zimoch $Source: /cvs/G/EPICS/App/scripts/ca,v $ -$Revision: 1.19 $ -$Date: 2011/12/20 16:18:26 $} {} version +$Revision: 1.20 $ +$Date: 2013/04/15 12:10:40 $} {} version proc printHelp {} { puts {usage: caget [flags] [ ...]} @@ -40,6 +40,7 @@ proc printHelp {} { puts {-prec override the PREC field} puts {-plain don't do any formatting} puts {-timeout timeout cawait after seconds} + puts {-stop exit after updates (for camon)} puts {-version print version and exit} puts {-help print this help text and exit} } @@ -54,6 +55,7 @@ if {![regexp {gets|get|putq|put|info|mon|do|wait} [file tail $argv0] command]} { } set flags {} +set stop 0 while {[string match "-*" [set flag [lindex $argv 0]]]} { switch -regexp -- $flag { {^-(\?)|(h(elp)?)$} { printHelp; exit} @@ -62,6 +64,8 @@ while {[string match "-*" [set flag [lindex $argv 0]]]} { set argv [lrange $argv 2 end] } {^-prec} { set prec [lindex $argv 1] set argv [lrange $argv 2 end] } + {^-stop} { set stop [lindex $argv 1] + set argv [lrange $argv 2 end] } default { lappend flags $flag set argv [lrange $argv 1 end] } } @@ -206,7 +210,7 @@ proc parsecond {cond} { } proc monitor {channel condition io value stat sevr time} { - global info oldval + global info flags oldval stop if {$io != "OK"} { unset info($channel) unset oldval($channel) @@ -221,6 +225,7 @@ proc monitor {channel condition io value stat sevr time} { if {[info exists oldval($channel)] && $oldval($channel) == $newval} return set oldval($channel) $newval puts $newval + if {$stop > 0 && [incr stop -1] < 1} { exit } return } if [expr $condition] {