~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/kernel/src/standard_error.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
 
%% 
4
 
%% Copyright Ericsson AB 2009. All Rights Reserved.
5
 
%% 
 
3
%%
 
4
%% Copyright Ericsson AB 2009-2010. All Rights Reserved.
 
5
%%
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
11
 
%% 
 
11
%%
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
16
 
%% 
 
16
%%
17
17
%% %CopyrightEnd%
18
18
%%
19
19
-module(standard_error).
24
24
 
25
25
-define(NAME, standard_error).
26
26
-define(PROCNAME_SUP, standard_error_sup).
27
 
%% Internal exports
28
 
-export([server/1, server/2]).
29
27
 
30
28
%% Defines for control ops
31
29
-define(CTRL_OP_GET_WINSIZE,100).
33
31
%%
34
32
%% The basic server and start-up.
35
33
%%
 
34
-spec start_link() -> 'ignore' | {'error',term()} | {'ok',pid()}.
 
35
 
36
36
start_link() ->
37
37
    supervisor_bridge:start_link({local, ?PROCNAME_SUP}, ?MODULE, []).
38
38
 
 
39
-spec terminate(term(), pid()) -> 'ok'.
 
40
 
39
41
terminate(_Reason,Pid) ->
40
42
    (catch exit(Pid,kill)),
41
43
    ok.
42
44
 
 
45
-spec init([]) -> {'error','no_stderror'} | {'ok',pid(),pid()}.
 
46
 
43
47
init([]) ->
44
48
    case (catch start_port([out,binary])) of
45
49
        Pid when is_pid(Pid) ->
48
52
            {error,no_stderror}
49
53
    end.
50
54
 
51
 
 
52
55
start_port(PortSettings) ->
53
 
    Id = spawn(?MODULE,server,[{fd,2,2},PortSettings]),
54
 
    register(?NAME,Id),
 
56
    Id = spawn(fun () -> server({fd,2,2}, PortSettings) end),
 
57
    register(?NAME, Id),
55
58
    Id.
56
59
 
57
 
 
58
 
server(Pid) when is_pid(Pid) ->
59
 
    process_flag(trap_exit, true),
60
 
    link(Pid),
61
 
    run(Pid).
62
 
 
63
60
server(PortName,PortSettings) ->
64
61
    process_flag(trap_exit, true),
65
62
    Port = open_port(PortName,PortSettings),
82
79
            server_loop(Port)
83
80
    end.
84
81
 
85
 
 
86
82
get_fd_geometry(Port) ->
87
83
    case (catch port_control(Port,?CTRL_OP_GET_WINSIZE,[])) of
88
 
        List when is_list(List), length(List) =:= 8 -> 
 
84
        List when length(List) =:= 8 ->
89
85
            <<W:32/native,H:32/native>> = list_to_binary(List),
90
86
            {W,H};
91
87
        _ ->
92
88
            error
93
89
    end.
94
90
 
95
 
 
96
91
%% NewSaveBuffer = io_request(Request, FromPid, ReplyAs, Port, SaveBuffer)
97
92
 
98
93
do_io_request(Req, From, ReplyAs, Port) ->
221
216
    {ok,ok}.
222
217
 
223
218
getopts(_Port) ->
224
 
    Uni = {unicode, case get(unicode) of
225
 
                       true ->
226
 
                           true;
227
 
                       _ ->
228
 
                           false
229
 
                   end},
 
219
    Uni = {unicode, get(unicode) =:= true},
230
220
    {ok,[Uni]}.
231
221
 
232
222
wrap_characters_to_binary(Chars,From,To) ->