25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +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) -> get_config_lines(Filename, TargetNumber, PreContext, PostContext) ->
{ok, Fd} = file:open(Filename, [read]), {ok, Fd} = file:open(Filename, [read]),
LNumbers = lists:seq(TargetNumber-PreContext, TargetNumber+PostContext), 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, []), R = get_config_lines2(Fd, NextL, 1, LNumbers, []),
file:close(Fd), file:close(Fd),
R. R.
@ -201,8 +201,8 @@ get_config_lines2(_Fd, eof, _CurrLine, _LNumbers, R) ->
lists:reverse(R); lists:reverse(R);
get_config_lines2(_Fd, _NewLine, _CurrLine, [], R) -> get_config_lines2(_Fd, _NewLine, _CurrLine, [], R) ->
lists:reverse(R); lists:reverse(R);
get_config_lines2(Fd, {ok, Data}, CurrLine, [NextWanted | LNumbers], R) -> get_config_lines2(Fd, Data, CurrLine, [NextWanted | LNumbers], R) when is_list(Data) ->
NextL = file:read_line(Fd), NextL = io:get_line(Fd, no_prompt),
if if
CurrLine >= NextWanted -> CurrLine >= NextWanted ->
Line2 = [integer_to_list(CurrLine), ": " | Data], Line2 = [integer_to_list(CurrLine), ": " | Data],