anchor.diff:  	    error
       end.
   
  -set_unicode_state(Iport, Bool) ->
  +set_unicode_state(Port, Bool) ->
       Data = case Bool of
   	       true -> [1];
   	       false -> [0]
   	   end,
  -    case (catch port_control(Iport,?CTRL_OP_SET_UNICODE_STATE,Data)) of
  +    case (catch port_control(Port,?CTRL_OP_SET_UNICODE_STATE,Data)) of
   	[Int] when Int > 0 -> 
  -	    {unicode, utf8};
  +	    true;
   	[Int] when Int =:= 0 ->
  -	    {unicode, false};
  +	    false;
   	_ ->
   	    error
       end.
  
positive.code: -define(CTRL_OP_GET_UNICODE_STATE, (101 + ?ERTS_TTYSL_DRV_CONTROL_MAGIC_NUMBER)).
  -define(CTRL_OP_SET_UNICODE_STATE, (102 + ?ERTS_TTYSL_DRV_CONTROL_MAGIC_NUMBER)).
  
  %% start()
  %% start(ArgumentList)
  %% start(PortName, Shell)
  %% start(InPortName, OutPortName, Shell)
  %%  Start the user driver server. The arguments to start/1 are slightly
  %%  strange as this may be called both at start up from the command line
  %%  and explicitly from other code.
  
  -spec start() -> pid().
  
  start() ->					%Default line editing shell
      spawn(user_drv, server, ['tty_sl -c -e',{shell,start,[init]}]).
  
  start([Pname]) ->
      spawn(user_drv, server, [Pname,{shell,start,[init]}]);
  start([Pname|Args]) ->
      spawn(user_drv, server, [Pname|Args]);
  start(Pname) ->
      spawn(user_drv, server, [Pname,{shell,start,[init]}]).
  
  start(Pname, Shell) ->
      spawn(user_drv, server, [Pname,Shell]).
  
  start(Iname, Oname, Shell) ->
      spawn(user_drv, server, [Iname,Oname,Shell]).
  
  %% server(Pid, Shell)
  %% server(Pname, Shell)
  %% server(Iname, Oname, Shell)
  %%  The initial calls to run the user driver. These start the port(s)
  %%  then call server1/3 to set everything else up.
  
  server(Pid, Shell) when is_pid(Pid) ->
      server1(Pid, Pid, Shell);
  server(Pname, Shell) ->
      process_flag(trap_exit, true),
      case catch open_port({spawn,Pname}, [eof]) of
  	{'EXIT', _} ->
  	    %% Let's try a dumb user instead
  	    user:start();
  	Port ->
  	    server1(Port, Port, Shell)
      end.
  
  server(Iname, Oname, Shell) ->
      process_flag(trap_exit, true),
      case catch open_port({spawn,Iname}, [eof]) of
  	{'EXIT', _} -> %% It might be a dumb terminal lets start dumb user
  	    user:start();
  	Iport ->
  	    Oport = open_port({spawn,Oname}, [eof]),
  	    server1(Iport, Oport, Shell)
      end.
  
  server1(Iport, Oport, Shell) ->
  
      Encoding =
          case get_unicode_state(Iport) of
              true -> unicode;
              false -> latin1
          end,
  
      %% Initialize standard_error
      ok = io:setopts(standard_error, [{encoding, Encoding}, {onlcr,true}]),
  
      put(eof, false),
      %% Start user and initial shell.
      User = start_user(),
      Gr1 = gr_add_cur(gr_new(), User, {}),
  
      {Curr,Shell1} =
  	case init:get_argument(remsh) of
  	    {ok,[[Node]]} ->
                  ANode =
  
negative.code: %% io_request(Request, InPort, OutPort)
  %% io_requests(Requests, InPort, OutPort)
  %% Note: InPort is unused.
  io_request({requests,Rs}, Port) ->
      io_requests(Rs, Port);
  io_request(Request, Port) ->
      case io_command(Request) of
          {Data, Reply} ->
              true = port_command(Port, Data),
              Reply;
          unhandled ->
              ok
      end.
  
  io_requests([R|Rs], Port) ->
      io_request(R, Port),
      io_requests(Rs, Port);
  io_requests([], _Port) ->
      ok.
  
  put_int16(N, Tail) ->
  