added text mode to support not treating the lines as numbers

git-svn-id: file:///home/svn/incoming/trunk@2487 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Spoon M 2005-05-09 22:01:28 +00:00
parent 2d68d56b63
commit f4620ffafd
1 changed files with 16 additions and 5 deletions

View File

@ -1,11 +1,18 @@
#!/usr/local/bin/ruby
if ARGV.empty?
puts "usage: <delta value> <files ...>"
puts "usage: <delta value | t> <files ...>"
exit(1)
end
delta = ARGV.shift.to_i
textmode = false
if ARGV[0] == 't'
ARGV.shift
textmode = true
else
delta = ARGV.shift.to_i
end
first = TRUE
last = [ ]
@ -17,9 +24,13 @@ last = [ ]
ARGV.each do |file|
cur = [ ]
IO.foreach(file) do |line|
addr = line.hex
(-delta .. delta).each do |d|
cur << addr + d
if textmode
cur << line
else
addr = line.hex
(-delta .. delta).each do |d|
cur << addr + d
end
end
end