erlang/erlang-find-requires.escript
2010-04-14 10:03:40 +00:00

20 lines
377 B
Erlang
Executable File

#!/usr/bin/escript
%% -*- erlang -*-
main(EbinFiles) ->
lists:foreach(
fun(BeamFile) ->
try
{ok, {_Module, [{imports,Imports}]}} = beam_lib:chunks(BeamFile, [imports]),
lists:foreach( fun({ModName,ModFun,Arity})->io:format("erlang(~s:~s/~p)~n", [ModName,ModFun,Arity]) end, Imports)
catch
_:_ ->
ok
end
end,
EbinFiles);
main(_) ->
halt(1).