anchor.diff:  	[A | _] ->
   	    A;
   	[] ->
  -	    %% XXX look for loopback interface and use that address,
  -	    %% if found. Don't assume loopback is 127.0.0.1.
  -	    "127.0.0.1"
  +	    get_defaultaddr()
       end.
   
   %%--------------------------------------------------------------------
  
positive.code: 
  %%--------------------------------------------------------------------
  %% Function: get_iplist()
  %% Descrip.: Get the addresses of all interfaces that are not loopback
  %%           interfaces, and which are 'up'.
  %% Returns : Addresses = list() of string()
  %%--------------------------------------------------------------------
  get_iplist() ->
      {ok, If} = inet:getiflist(),
      get_if(If).
  
  %%--------------------------------------------------------------------
  %% Function: get_if(IfList)
  %%           IfList = list() of string(), list of interface names
  %% Descrip.: Get the addresses of all interfaces named in IfList that
  %%           are not loopback interfaces, and which are 'up'.
  %% Returns : Addresses = list() of string()
  %%--------------------------------------------------------------------
  get_if(L) ->
      get_if(L, []).
  
  get_if([], Res) ->
      Res;
  
  get_if([H | T], Res) ->
      {ok, B} = inet:ifget(H, [addr, flags]),
      {value, {flags, Flags}} = lists:keysearch(flags, 1, B),
      case usable_if(Flags) of
  	false ->
  	    %% Ignore unusable interfaces
  	    get_if(T, Res);
  	true ->
  	    case lists:keysearch(addr, 1, B) of
  		{value, {addr, Addr}} ->
  		    get_if(T, [makeip(Addr) | Res]);
  		_ ->
  		    %% Interface has no address, might happen on BSD
  		    get_if(T, Res)
  	    end
      end.
  
  %%--------------------------------------------------------------------
  %% Function: usable_if(Flags)
  %%           Flags = list() of atom()
  %% Descrip.: Interface must be up and not loopback to be considered
  %%           usable.
  %% Returns : true | false
  %%--------------------------------------------------------------------
  usable_if(Flags) ->
      not lists:member(loopback, Flags)
  	and lists:member(up, Flags).
  
negative.code: myip_list() ->
      case get_iplist() of
  	[] ->
  	    [get_defaultaddr()];
  	L ->
  	    L
      end.
  