summaryrefslogtreecommitdiffstats
path: root/erlang-find-requires.escript
blob: 1a16f76e626e10d0953095338ca6a9b4599d41ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/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).