1#!/usr/bin/ruby 2if ARGV.length < 1 then 3 $stderr.print "usage: filearch filename\n" 4 exit(1) 5end 6file = ARGV[0] 7IO.popen("/usr/bin/otool -hv #{file}", "r").grep(/MAGIC/) do |line| 8 fields = line.split(/\s+/).delete_if {|f| f.empty?} 9 if 0 == fields[2].casecmp("all") 10 puts fields[1].downcase 11 else 12 puts fields[2] 13 end 14end 15