From 5db069285487ab92124426aeef725903c18940a5 Mon Sep 17 00:00:00 2001 From: zimoch Date: Thu, 12 Nov 2009 14:29:13 +0000 Subject: [PATCH] display char arrays as strings --- ca | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ca b/ca index 43ad052..547f2b5 100755 --- a/ca +++ b/ca @@ -2,12 +2,12 @@ # ca* by Dirk Zimoch # $Source: /cvs/G/EPICS/App/scripts/ca,v $ -# $Date: 2006/10/02 12:25:31 $ +# $Date: 2009/11/12 14:29:13 $ regsub -all {\$} {ca* by Dirk Zimoch $Source: /cvs/G/EPICS/App/scripts/ca,v $ -$Revision: 1.14 $ -$Date: 2006/10/02 12:25:31 $} {} version +$Revision: 1.15 $ +$Date: 2009/11/12 14:29:13 $} {} version set auto_path [concat $env(SLSBASE)/lib/tcl $auto_path] @@ -86,6 +86,14 @@ proc formatval {channel {value {}} {sevr {}} {stat {}} {time {}}} { foreach {attr val} $info($channel) { set $attr $val } + if {$TYPE == "DBF_CHAR"} { + foreach char $VAL { + append val [format "%c" $char] + } + set SIZE 1 + set TYPE DBF_STRING + set VAL $val + } if {[lsearch $flags -plain] != -1} { set formatted $VAL set status "" @@ -113,7 +121,7 @@ proc formatval {channel {value {}} {sevr {}} {stat {}} {time {}}} { } } if {$TYPE == "DBF_STRING" || $TYPE == "DBF_ENUM"} { - set val \"$val\" + set val \"[string map {\" \\\" \\ \\\\ \a \\a \b \\b \c \\c \n \\n \r \\r \t \\t \v \\v} $val]\" } else { if {[lsearch $flags -hex] != -1} { catch {