added text mode to support not treating the lines as numbers
git-svn-id: file:///home/svn/incoming/trunk@2487 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
2d68d56b63
commit
f4620ffafd
13
correlate.rb
13
correlate.rb
|
@ -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
|
||||
|
||||
textmode = false
|
||||
|
||||
if ARGV[0] == 't'
|
||||
ARGV.shift
|
||||
textmode = true
|
||||
else
|
||||
delta = ARGV.shift.to_i
|
||||
end
|
||||
|
||||
first = TRUE
|
||||
last = [ ]
|
||||
|
@ -17,11 +24,15 @@ last = [ ]
|
|||
ARGV.each do |file|
|
||||
cur = [ ]
|
||||
IO.foreach(file) do |line|
|
||||
if textmode
|
||||
cur << line
|
||||
else
|
||||
addr = line.hex
|
||||
(-delta .. delta).each do |d|
|
||||
cur << addr + d
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if first
|
||||
first = FALSE
|
||||
|
|
Loading…
Reference in New Issue