anchor.diff:  ploop(init, State) ->
       case receive_reply(State) of
   	{ok, Reply, State2} ->
  -						% io:format("INIT got +OK ~s\n", [Reply]),
   	    psend("USER " ++ State#pstate.user, State#pstate.port),
   	    ploop(user, State2);
   	{error, Reason, State2} ->
  -						% io:format("INIT got -ERR ~s\n", [Reason]),
   	    State#pstate.from ! {pop_response, {error, Reason}},
   	    gen_tcp:close(State#pstate.port);
   	{more, State2} ->
  -						% io:format("INIT got more\n", []),
   	    ploop(init, State2)
       end;
   
   ploop(user, State) ->
       case receive_reply(State) of
   	{ok, Reply, State2} ->
  -						% io:format("USER got +OK ~s\n", [Reply]),
   	    psend("PASS " ++ State#pstate.pass, State#pstate.port),
   	    ploop(pass, State2);
   	{error, Reason, State2} ->
  -						% io:format("USER got -ERR ~s\n", [Reason]),
   	    State#pstate.from ! {pop_response, {error, Reason}},
   	    gen_tcp:close(State#pstate.port);
   	{more, State2} ->
  -						% io:format("USER got more\n", []),
   	    ploop(user, State2)
       end;
   ploop(pass, State) ->
       case receive_reply(State) of
   	{ok, Reply, State2} ->
  -						% io:format("PASS got +OK ~s\n", [Reply]),
   	    next_cmd(State);
   	{error, Reason, State2} ->
  -						% io:format("PASS got -ERR ~s\n", [Reason]),
   	    State#pstate.from ! {pop_response, {error, Reason}},
   	    gen_tcp:close(State#pstate.port);
   	{more, State2} ->
  -						% io:format("PASS got more\n", []),
   	    ploop(pass, State2)
       end;
   ploop(sl, State) ->
       case receive_reply(State) of
   	{ok, Reply, State2} ->
  -						% io:format("SL got +OK ~s\n", [Reply]),
   	    next_cmd(State2#pstate{reply=[{ok,Reply}|State2#pstate.reply]});
   	{error, Reason, State2} ->
  -						% io:format("SL got -ERR ~s\n", [Reason]),
   	    next_cmd(State2#pstate{reply=[{error,Reason}|
   					  State2#pstate.reply]});
   	{more, State2} ->
  -						% io:format("SL got more\n", []),
   	    ploop(sl, State2)
       end;
   ploop(sized, State) ->
       case receive_reply(State) of
   	{ok, Reply, State2} ->
   	    Size = to_int(Reply),
  -						% io:format("MLINE got +OK size=~p\n", [Size]),
   	    ploop(sized_cont, State2#pstate{remain=Size,lines=[]});
   	{error, Reason, State2} ->
  -						% io:format("MLINE got -ERR ~s\n", [Reason]),
   	    next_cmd(State2#pstate{reply=[{error,Reason}|
   					  State2#pstate.reply]});
   	{more, State2} ->
  -						% io:format("MLINE got more\n", []),
   	    ploop(ml, State2)
       end;
   ploop(sized_cont, State) ->
       case receive_data(State) of
   	{error, Reason, State2} ->
  -						% io:format("SCONT got -ERR ~s\n", [Reason]),
   	    next_cmd(State2#pstate{reply=[{error,Reason}|
   					  State2#pstate.reply]});
   	{more, State2} ->
  -						% io:format("SCONT got more\n", []),
   	    ploop(sized_cont, State2);
   	{done, State2} ->
  -						% io:format("SCONT got done\n", []),
   	    Data = lists:reverse(State2#pstate.lines),
   	    next_cmd(State2#pstate{reply=[{ok, Data}|State2#pstate.reply]})
       end;
   ploop(ml, State) ->
       case receive_reply(State) of
   	{ok, Reply, State2} ->
  -						% io:format("MLINE got +OK ~s\n", [Reply]),
   	    ploop(ml_cont, State2#pstate{lines=[]});
   	{error, Reason, State2} ->
  -						% io:format("MLINE got -ERR ~s\n", [Reason]),
   	    next_cmd(State2#pstate{reply=[{error,Reason}|
   					  State2#pstate.reply]});
   	{more, State2} ->
  -						% io:format("MLINE got more\n", []),
   	    ploop(ml, State2)
       end;
   ploop(ml_cont, State) ->
       case receive_reply(State) of
   	{line, Line, State2} ->
  -						% io:format("MCONT got +OK ~s\n", [Line]),
   	    Lines = State2#pstate.lines,
   	    ploop(ml_cont, State2#pstate{lines=[Line|Lines]});
   	{error, Reason, State2} ->
  -						% io:format("MCONT got -ERR ~s\n", [Reason]),
   	    next_cmd(State2#pstate{reply=[{error,Reason}|
   					  State2#pstate.reply]});
   	{more, State2} ->
  -						% io:format("MCONT got more\n", []),
   	    ploop(ml_cont, State2);
   	{done, State2} ->
  -						% io:format("MCONT got done\n", []),
   	    Lines = lists:reverse(State2#pstate.lines),
   	    next_cmd(State2#pstate{reply=[{ok, Lines}|State2#pstate.reply]})
       end.
   
  -						%
  +%%
   
   next_cmd(State=#pstate{cmd=Cmd,reply=Reply}) when Cmd==[]->
       State#pstate.from ! {pop_response, lists:reverse(Reply)},
  
positive.code: 	["ttl", '=', IntList] ->
  	    case (catch list_to_integer(IntList)) of
  		{'EXIT', _} ->
  		    error_logger:info_msg("Yaws webmail:  expect integer at line ~p", [Lno]),
  		    read_config(FD, Cfg, Lno+1, Next);
  		Int ->
  		    read_config(FD, Cfg#cfg{ttl = Int}, Lno+1, Next)
  
negative.code: char_class($\t) -> tab;
  char_class(O)   -> text.
      
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  sleep(X) ->
      receive
  	xxxxxxx ->  ok
      after
  	X -> ok
      end.
  
  	
  %%%%%%%%%%%%%%%%%%%%%% read cfg file %%%%%%%%%%%%%%%%%%
  %% def for root is: /etc/mail/yaws-webmail.conf
  
  read_config() ->
      Paths = case yaws:getuid() of
  		{ok, "0"} ->
  