anchor.diff:      case gen_tcp:recv(Sock, 1) of
           {ok, B} ->
               Acc2 = <<Acc/binary, B/binary>>,
  -            case suffix(Acc2, 2) of
  -                <<"\r\n">> -> {ok, Acc2};
  +            {Line, Suffix} = split_binary_suffix(Acc2, 2),
  +            case Suffix of
  +                <<"\r\n">> -> {ok, Line};
                   _          -> recv_line(Sock, Acc2)
               end;
           Err -> Err
       end.
   
  -%% @doc returns the suffix for a binary, or <<>> if the binary is too short.
  -suffix(_, 0) -> <<>>;
  -suffix(Bin, SuffixLen) ->
  +%% @doc Returns the {body, suffix} binary parts for a binary;
  +%%      Returns {body, <<>>} if the binary is too short.
  +%%
  +split_binary_suffix(Bin, 0) -> {Bin, <<>>};
  +split_binary_suffix(Bin, SuffixLen) ->
       case size(Bin) >= SuffixLen of
  -        true  -> {_, Suffix} = split_binary(Bin, size(Bin) - 2),
  -                 Suffix;
  -        false -> <<>>
  +        true  -> split_binary(Bin, size(Bin) - SuffixLen);
  +        false -> {Bin, <<>>}
       end.
   
   % -------------------------------------------------
   
   suffix_test() ->
  -    ?assertMatch(<<"lo">>, suffix(<<"hello">>, 2)),
  -    ?assertMatch(<<"lo">>, suffix(<<"lo">>, 2)),
  -    ?assertMatch(<<>>, suffix(<<"o">>, 2)),
  -    ?assertMatch(<<>>, suffix(<<>>, 2)),
  -    ?assertMatch(<<>>, suffix(<<>>, 0)),
  +    ?assertMatch({<<"hel">>, <<"lo">>}, split_binary_suffix(<<"hello">>, 2)),
  +    ?assertMatch({<<"hello">>, <<>>}, split_binary_suffix(<<"hello">>, 0)),
  +    ?assertMatch({<<>>, <<"lo">>}, split_binary_suffix(<<"lo">>, 2)),
  +    ?assertMatch({<<"o">>, <<>>}, split_binary_suffix(<<"o">>, 2)),
  +    ?assertMatch({<<>>, <<>>}, split_binary_suffix(<<>>, 2)),
  +    ?assertMatch({<<>>, <<>>}, split_binary_suffix(<<>>, 0)),
       ok.
   
   recv_line_test() ->
  
positive.code:             get_recv(Sock, RecvCallback)
      end.
  
  %% @doc send an iolist and receive a single line back.
  send_recv(Sock, IoList) ->
      send_recv(Sock, IoList, undefined).
  
  
negative.code:     (fun () ->
          {ok, RB} = cmd(version, Sock, nil, nil),
          R = binary_to_list(RB),
          ?assert(starts_with(R, "VERSION "))
      end)(),
  
      ok = gen_tcp:close(Sock).
  