25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Use alternative of file:read_line/1 to not require R13B02

This commit is contained in:
Badlop 2010-02-20 19:31:36 +01:00
parent 9890cc89b6
commit ebc82f2968

View File

@ -192,7 +192,7 @@ describe_config_problem(Filename, Reason, LineNumber) ->
get_config_lines(Filename, TargetNumber, PreContext, PostContext) ->
{ok, Fd} = file:open(Filename, [read]),
LNumbers = lists:seq(TargetNumber-PreContext, TargetNumber+PostContext),
NextL = file:read_line(Fd),
NextL = io:get_line(Fd, no_prompt),
R = get_config_lines2(Fd, NextL, 1, LNumbers, []),
file:close(Fd),
R.
@ -201,8 +201,8 @@ get_config_lines2(_Fd, eof, _CurrLine, _LNumbers, R) ->
lists:reverse(R);
get_config_lines2(_Fd, _NewLine, _CurrLine, [], R) ->
lists:reverse(R);
get_config_lines2(Fd, {ok, Data}, CurrLine, [NextWanted | LNumbers], R) ->
NextL = file:read_line(Fd),
get_config_lines2(Fd, Data, CurrLine, [NextWanted | LNumbers], R) when is_list(Data) ->
NextL = io:get_line(Fd, no_prompt),
if
CurrLine >= NextWanted ->
Line2 = [integer_to_list(CurrLine), ": " | Data],