diff options
author | Erlang/OTP <[email protected]> | 2010-04-29 15:25:27 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-04-29 15:25:27 +0000 |
commit | b328564bfe321c2df597c77fea57566ee8d00f2b (patch) | |
tree | 48d06057fad0819ebdf2811992631e6ae8ebb2c9 /lib/kernel/src/user.erl | |
parent | c8fbe3f82050477a713b22b5d3b671718588aa79 (diff) | |
parent | 75ea6a39d1cf4bd4a67391595b90d8d90155d012 (diff) | |
download | otp-b328564bfe321c2df597c77fea57566ee8d00f2b.tar.gz otp-b328564bfe321c2df597c77fea57566ee8d00f2b.tar.bz2 otp-b328564bfe321c2df597c77fea57566ee8d00f2b.zip |
Merge branch 'ks/kernel' into dev
* ks/kernel:
kernel: Clean up as suggested by tidier
OTP-8606 ks/kernel
Diffstat (limited to 'lib/kernel/src/user.erl')
-rw-r--r-- | lib/kernel/src/user.erl | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/kernel/src/user.erl b/lib/kernel/src/user.erl index 17dc5a56a2..88f32df20b 100644 --- a/lib/kernel/src/user.erl +++ b/lib/kernel/src/user.erl @@ -26,9 +26,6 @@ -define(NAME, user). -%% Internal exports --export([server/1, server/2]). - %% Defines for control ops -define(CTRL_OP_GET_WINSIZE,100). @@ -43,7 +40,7 @@ start([Mod,Fun|Args]) -> %% Mod,Fun,Args should return a pid. That process is supposed to act %% as the io port. Pid = apply(Mod, Fun, Args), % This better work! - Id = spawn(?MODULE, server, [Pid]), + Id = spawn(fun() -> server(Pid) end), register(?NAME, Id), Id. @@ -52,8 +49,8 @@ start_out() -> start_port([out,binary]). start_port(PortSettings) -> - Id = spawn(?MODULE,server,[{fd,0,1},PortSettings]), - register(?NAME,Id), + Id = spawn(fun() -> server({fd,0,1}, PortSettings) end), + register(?NAME, Id), Id. %% Return the pid of the shell process. @@ -72,7 +69,6 @@ interfaces(User) -> [] end. - server(Pid) when is_pid(Pid) -> process_flag(trap_exit, true), link(Pid), @@ -104,7 +100,7 @@ catch_loop(Port, Shell, Q) -> new_shell -> exit(Shell, kill), catch_loop(Port, start_new_shell()); - {unknown_exit,{Shell,Reason},_} -> % shell has exited + {unknown_exit,{Shell,Reason},_} -> % shell has exited case Reason of normal -> put_chars("*** ", Port, []); @@ -172,7 +168,7 @@ server_loop(Port, Q) -> get_fd_geometry(Port) -> case (catch port_control(Port,?CTRL_OP_GET_WINSIZE,[])) of - List when is_list(List), length(List) =:= 8 -> + List when length(List) =:= 8 -> <<W:32/native,H:32/native>> = list_to_binary(List), {W,H}; _ -> @@ -373,12 +369,7 @@ do_setopts(Opts, _Port, Q) -> end. getopts(_Port,Q) -> - Bin = {binary, case get(read_mode) of - binary -> - true; - _ -> - false - end}, + Bin = {binary, get(read_mode) =:= binary}, Uni = {encoding, case get(unicode) of true -> unicode; |