root/src/lua/test/xd.lua

Revision 22d1941d0ca5ba7027cdfa51ce34bd1d8fb1931e, 364 bytes (checked in by Theo Schlossnagle <jesus@omniti.com>, 10 years ago)

take the version out... it is what it is

  • Property mode set to 100644
Line 
1 -- hex dump
2 -- usage: lua xd.lua < file
3
4 local offset=0
5 while true do
6  local s=io.read(16)
7  if s==nil then return end
8  io.write(string.format("%08X  ",offset))
9  string.gsub(s,"(.)",
10         function (c) io.write(string.format("%02X ",string.byte(c))) end)
11  io.write(string.rep(" ",3*(16-string.len(s))))
12  io.write(" ",string.gsub(s,"%c","."),"\n")
13  offset=offset+16
14 end
Note: See TracBrowser for help on using the browser.