anchor.diff:  	    next_cmd(State);
   	{error, Reason, State2} ->
   	    State#pstate.from ! {pop_response, {error, Reason}},
  -	    gen_tcp:close(State#pstate.port);
  +	    pop_close(State#pstate.port);
   	{more, State2} ->
   	    ploop(pass, State2)
       end;
  
positive.code: 	    ploop(pass, State2);
  	{error, Reason, State2} ->
  	    State#pstate.from ! {pop_response, {error, Reason}},
  	    gen_tcp:close(State#pstate.port);
  	{more, State2} ->
  	    ploop(user, State2)
      end;
  
negative.code: 
  %%
  
  next_cmd(State=#pstate{cmd=Cmd,reply=Reply}) when Cmd==quit->
      State#pstate.from ! {pop_response, lists:reverse(Reply)},
      gen_tcp:close(State#pstate.port);
  next_cmd(State=#pstate{cmd=Cmd}) when Cmd==[]->
      psend("QUIT", State#pstate.port),
      ploop(sl_flush, State#pstate{cmd=quit});
  next_cmd(State=#pstate{cmd=[Cmd|Cmds]}) ->
      {C,S} = Cmd,
      psend(C, State#pstate.port),
      ploop(S, State#pstate{cmd=Cmds}).
  
  %%
  
  pop_close(Port) ->
      psend("quit", Port),
      gen_tcp:close(Port).
  
  %%
  
  