webif/webif/lib/hexdump
hummypkg 2c2c434fec add network settings (beta)
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2212 2a923420-c742-0410-a762-8d5b09965624
2015-01-19 21:16:52 +00:00

18 lines
400 B
Plaintext

package require binary
proc hexdump data {
set dump ""
set n 0
while {$n < [string bytelength $data]} {
set bytes [string byterange $data $n $($n+15)]
binary scan $bytes H* hex
set hex [regexp -all -inline .. $hex]
regsub -all -- {[\x01-\x1f\x80-\xff]} [\
string map {\x00 .} $bytes] . ascii
append dump [format "%04X: %-48s %-16s\n" $n $hex $ascii]
incr n 16
}
puts $dump
}