anchor.diff:  start_link() ->
     gen_server:start_link(?MODULE, [], []).
   
  +-spec list_devices(pid()) -> [_].
  +list_devices(Pid) ->
  +  gen_server:call(Pid, list_devices).
  +
   %% gen_server.
   
   init([]) ->
  -  {ok, #state{}}.
  +  {ok, #state{}, 0}.
   
  +handle_call(list_devices, _From, S=#state{devices=Devs}) ->
  +  {reply, Devs, S};
   handle_call(_Request, _From, State) ->
     {reply, ignored, State}.
   
   handle_cast(_Msg, State) ->
     {noreply, State}.
   
  +handle_info(timeout, #state{devices=undefined}) ->
  +  NewState = #state{devices=parse_devices()},
  +  {noreply, NewState};
   handle_info(_Info, State) ->
     {noreply, State}.
   
  
positive.code: -module(device_directory).
  -behaviour(gen_server).
  
  %% API.
  -export([start_link/0]).
  
  %% gen_server.
  -export([init/1]).
  
negative.code: 
  get_devices() ->
    CMD = "tdtool --list-devices | awk 'BEGIN {FS=\" |=|\\t\"} NR == 1 {printf(\"[ \")} NR > 1 {printf(\"\\n ,\")}{printf(\" {device, %s, \\\"%s\\\"}\", $4,$6)} END {printf(\" ].\\n\")}'",
    lager:info("devices found: " ++ CMD),
    os:cmd(CMD).
  
  %% vim: tabstop=2 shiftwidth=2 expandtab
  