writetree - sorted items and continue on error for more resiliency

This commit is contained in:
Douglas Clowes
2014-04-22 15:03:19 +10:00
parent ad50eaca6a
commit a43ca1cf94

View File

@ -15,36 +15,36 @@
} else { } else {
set line "$nam ([hinfo $tc_root]) = $val" set line "$nam ([hinfo $tc_root]) = $val"
} }
clientput "$space* $line"
} message ] { } message ] {
clientput "Error in writeNode/hinfo for $tc_root : $message" clientput "Error in writeNode/hinfo for $tc_root : $message"
return
} }
clientput "$space* $line"
if {"[string tolower "$do_props"]" == "-prop"} { if {"[string tolower "$do_props"]" == "-prop"} {
if [ catch { if [ catch {
set props [hlistprop $tc_root] set props [lsort [hlistprop $tc_root]]
} message ] { #clientput "<<$props>>"
clientput "Error in writeNode/hlistprop for $tc_root : $message" foreach prop $props {
return if [ catch {
} # guard against embedded spaces producing false properties
#clientput "<<$props>>" #clientput "prop: $prop"
foreach prop $props { set flds [split $prop "="]
#clientput "prop: $prop" #clientput "flds: $flds"
set flds [split $prop "="] if {[llength $flds] > 1} {
#clientput "flds: $flds" set nam [lindex $flds 0]
if {[llength $flds] > 1} { if {[hpropexists $tc_root $nam]} {
set fld0 [lindex $flds 0] set rst [hgetpropval $tc_root $nam]
#clientput "fld0: $fld0" clientput "$space - $nam=$rst"
if {[hpropexists $tc_root $fld0]} { }
set rst [hgetprop $tc_root $fld0] }
set nam [lindex [split [lindex $rst 0] "."] 1] } message ] {
set rst [join [lrange [split $rst " "] 1 end] " "] clientput "Error in writeNode/hlistprop for $tc_root : $message"
clientput "$space - $nam $rst"
} }
} }
} message ] {
clientput "Error in writeNode/hlistprop for $tc_root : $message"
} }
} }
foreach node [hlist $tc_root] { foreach node [lsort [hlist $tc_root]] {
::utility::writeNode $tc_root/$node "$do_props" [expr {$level + 1}] ::utility::writeNode $tc_root/$node "$do_props" [expr {$level + 1}]
} }
} message ] { } message ] {