From: marko Date: Tue, 4 Sep 2007 12:08:16 +0000 (+0000) Subject: Remove comments from a switch section in popupConfigApply proc, since X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=34275621266c51202f50b2cf1eb3c54148ff0d86;p=imunes.git Remove comments from a switch section in popupConfigApply proc, since per "man n switch" those are prohibited outside the execution body of one of the matching patterns. While here, do some indentation cleanups. Bug found by: Submitted by: Reviewed by: Approved by: Obtained from: --- diff --git a/editor.tcl b/editor.tcl index 4552772..9c97abc 100755 --- a/editor.tcl +++ b/editor.tcl @@ -1,4 +1,4 @@ -# $Id: editor.tcl,v 1.62.2.12 2007/09/03 12:00:29 marko Exp $ +# $Id: editor.tcl,v 1.62.2.13 2007/09/04 12:08:16 marko Exp $ # # Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved. # @@ -2618,9 +2618,6 @@ proc popupConfigApply { wi object_type target phase } { return } switch -exact -- $object_type { - # - # Node - # node { set type [nodeType $target] set model [getNodeModel $target] @@ -2664,127 +2661,123 @@ proc popupConfigApply { wi object_type target phase } { } if {[[typemodel $target].layer] == "NETWORK"} { - foreach ifc [ifcList $target] { - # - # Operational state - # - global [subst ifoper$ifc] - set ifoperstate [subst $[subst ifoper$ifc]] - set oldifoperstate [getIfcOperState $target $ifc] - if { $ifoperstate != $oldifoperstate } { - setIfcOperState $target $ifc $ifoperstate - set changed 1 - } + foreach ifc [ifcList $target] { + # + # Operational state + # + global [subst ifoper$ifc] + set ifoperstate [subst $[subst ifoper$ifc]] + set oldifoperstate [getIfcOperState $target $ifc] + if { $ifoperstate != $oldifoperstate } { + setIfcOperState $target $ifc $ifoperstate + set changed 1 + } - # - # IPv4 / IPv6 address & MTU - # - set ipaddr [$wi.if$ifc.cfg.ipv4.addrv get] - set oldipaddr [getIfcIPv4addr $target $ifc] - if { $ipaddr != $oldipaddr } { - setIfcIPv4addr $target $ifc $ipaddr - set changed 1 - } - set ipaddr [$wi.if$ifc.cfg.ipv6.addrv get] - set oldipaddr [getIfcIPv6addr $target $ifc] - if { $ipaddr != $oldipaddr } { - setIfcIPv6addr $target $ifc $ipaddr - set changed 1 - } + # + # IPv4 / IPv6 address & MTU + # + set ipaddr [$wi.if$ifc.cfg.ipv4.addrv get] + set oldipaddr [getIfcIPv4addr $target $ifc] + if { $ipaddr != $oldipaddr } { + setIfcIPv4addr $target $ifc $ipaddr + set changed 1 + } + set ipaddr [$wi.if$ifc.cfg.ipv6.addrv get] + set oldipaddr [getIfcIPv6addr $target $ifc] + if { $ipaddr != $oldipaddr } { + setIfcIPv6addr $target $ifc $ipaddr + set changed 1 + } - set mtu [$wi.if$ifc.label.mtuv get] - set oldmtu [getIfcMTU $target $ifc] - if { $mtu != $oldmtu } { - setIfcMTU $target $ifc $mtu - set changed 1 + set mtu [$wi.if$ifc.label.mtuv get] + set oldmtu [getIfcMTU $target $ifc] + if { $mtu != $oldmtu } { + setIfcMTU $target $ifc $mtu + set changed 1 + } } - } - - set oldIPv4statrtes [lsort [getStatIPv4routes $target]] - set oldIPv6statrtes [lsort [getStatIPv6routes $target]] - set newIPv4statrtes {} - set newIPv6statrtes {} - set i 1 - while { 1 } { - set text [$wi.statrt.cfg.text get $i.0 $i.end] - set rtentry [lrange [split [string trim $text]] 0 2] - if { $rtentry == "" } { - break - } - set dst [lindex $rtentry 0] - set gw [lindex $rtentry 1] - set metric [lindex $rtentry 2] - if { [string is integer $metric] != 1 || $metric > 65535 } { - break - } - if { [checkIPv4Net $dst] == 1 } { - if { [checkIPv4Addr $gw] == 1 } { - lappend newIPv4statrtes [string trim "$dst $gw $metric"] - } else { + set oldIPv4statrtes [lsort [getStatIPv4routes $target]] + set oldIPv6statrtes [lsort [getStatIPv6routes $target]] + set newIPv4statrtes {} + set newIPv6statrtes {} + set i 1 + while { 1 } { + set text [$wi.statrt.cfg.text get $i.0 $i.end] + set rtentry [lrange [split [string trim $text]] 0 2] + if { $rtentry == "" } { + break + } + set dst [lindex $rtentry 0] + set gw [lindex $rtentry 1] + set metric [lindex $rtentry 2] + if { [string is integer $metric] != 1 || $metric > 65535 } { break } - } elseif { [checkIPv6Net $dst] == 1 } { - if { [checkIPv6Addr $gw] == 1 } { - lappend newIPv6statrtes [string trim "$dst $gw $metric"] + if { [checkIPv4Net $dst] == 1 } { + if { [checkIPv4Addr $gw] == 1 } { + lappend newIPv4statrtes [string trim "$dst $gw $metric"] + } else { + break + } + } elseif { [checkIPv6Net $dst] == 1 } { + if { [checkIPv6Addr $gw] == 1 } { + lappend newIPv6statrtes [string trim "$dst $gw $metric"] + } else { + break + } } else { break } - } else { - break + incr i + } + set newIPv4statrtes [lsort $newIPv4statrtes] + if { $oldIPv4statrtes != $newIPv4statrtes } { + setStatIPv4routes $target $newIPv4statrtes + set changed 1 + } + set newIPv6statrtes [lsort $newIPv6statrtes] + if { $oldIPv6statrtes != $newIPv6statrtes } { + setStatIPv6routes $target $newIPv6statrtes + set changed 1 } - incr i - } - set newIPv4statrtes [lsort $newIPv4statrtes] - if { $oldIPv4statrtes != $newIPv4statrtes } { - setStatIPv4routes $target $newIPv4statrtes - set changed 1 - } - set newIPv6statrtes [lsort $newIPv6statrtes] - if { $oldIPv6statrtes != $newIPv6statrtes } { - setStatIPv6routes $target $newIPv6statrtes - set changed 1 - } - set oldcustomenabled [getCustomEnabled $target] - if {$oldcustomenabled != $customEnabled} { - setCustomEnabled $target $customEnabled - set changed 1 - } + set oldcustomenabled [getCustomEnabled $target] + if {$oldcustomenabled != $customEnabled} { + setCustomEnabled $target $customEnabled + set changed 1 + } - if { $showIPsecConfig == 0 } { - set ipsecEnabled 0 - } - set oldipsecenabled [getIpsecEnabled $target] - if {$oldipsecenabled != $ipsecEnabled} { - setIpsecEnabled $target $ipsecEnabled - set changed 1 - } + if { $showIPsecConfig == 0 } { + set ipsecEnabled 0 + } + set oldipsecenabled [getIpsecEnabled $target] + if {$oldipsecenabled != $ipsecEnabled} { + setIpsecEnabled $target $ipsecEnabled + set changed 1 + } - set oldcpuconf [getNodeCPUConf $target] - set newcpuconf {} - set cpumin [$wi.cpu.mine get] - set cpumax [$wi.cpu.maxe get] - set cpuweight [$wi.cpu.weighte get] - if { $cpumin != "" } { - lappend newcpuconf "min $cpumin" - } - if { $cpumax != "" } { - lappend newcpuconf "max $cpumax" - } - if { $cpuweight != "" } { - lappend newcpuconf "weight $cpuweight" - } - if { $oldcpuconf != $newcpuconf } { - setNodeCPUConf $target [list $newcpuconf] - set changed 1 + set oldcpuconf [getNodeCPUConf $target] + set newcpuconf {} + set cpumin [$wi.cpu.mine get] + set cpumax [$wi.cpu.maxe get] + set cpuweight [$wi.cpu.weighte get] + if { $cpumin != "" } { + lappend newcpuconf "min $cpumin" + } + if { $cpumax != "" } { + lappend newcpuconf "max $cpumax" + } + if { $cpuweight != "" } { + lappend newcpuconf "weight $cpuweight" + } + if { $oldcpuconf != $newcpuconf } { + setNodeCPUConf $target [list $newcpuconf] + set changed 1 + } } - } # XXX node } - # - # Link - # link { set mirror [getLinkMirror $target] set bw [$wi.bandwidth.value get] @@ -2837,7 +2830,7 @@ proc popupConfigApply { wi object_type target phase } { if { $changed == 1 && $oper_mode == "exec" } { execSetLinkParams $eid $target } - } # XXX link + } } if { $changed == 1 } { redrawAll