summaryrefslogtreecommitdiff
path: root/ext/aix_mksym.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/aix_mksym.rb')
-rw-r--r--ext/aix_mksym.rb39
1 files changed, 9 insertions, 30 deletions
diff --git a/ext/aix_mksym.rb b/ext/aix_mksym.rb
index 7e1af283dc..34b0de727e 100644
--- a/ext/aix_mksym.rb
+++ b/ext/aix_mksym.rb
@@ -1,33 +1,12 @@
-def uniq(data)
- last=nil
- data.delete_if do |name|
- if last == name
- TRUE
- else
- last = name
- FALSE
- end
+data = []
+IO.foreach("|/usr/ccs/bin/nm -p #{ARGV[0]}") do |line|
+ line = line.split
+ case line[1]
+ when "B", "D"
+ data << line[0]
end
end
-
-def extract(nm, out)
- data = nm.readlines.collect{|line|
- line = line.split
- case line[1]
- when "B", "D"
- line[0]
- else
- next
- end
- }.compact!.sort!
- uniq(data)
- exp = open(out, "w")
- exp.printf "#!\n"
- for line in data
- exp.printf "%s\n", line
- end
- exp.close
- nm.close
-end
-extract(open("|/usr/ccs/bin/nm -p ../libruby.a"), "../ruby.imp")
+data.uniq!
+data.sort!
+open(ARGV[1], "w") {|exp| exp.puts "#!", data}