Hello,
I need experts help in converting the below tcl function to korn shell function equivalent.
proc lsNetMaskToBits {mask} {
set dw [lsNetIpToDword $mask] ; # Top N bits set
set dw 0x[format %X $dw] ; # Make sure it's hexadecimal, else XOR fails.
puts "lsNetMaskToBits dw $dw"
set dw [expr $dw ^ 0xFFFFFFFF] ; # Complement => low 32-N bits set.
for {set nb 32} {$dw != 0} {incr nb -1} {set dw [expr $dw >> 1]}
return $nb
}
where lsNetIpToDword function returns hexadecimal value of IP address
for example: 255.255.0.0
lsNetIpToDword returns: FFFF0000
Thanks for your help
- JackMelson