diff options
author | lukeg <lukeg> | 2003-02-21 21:02:13 +0000 |
---|---|---|
committer | lukeg <lukeg> | 2003-02-21 21:02:13 +0000 |
commit | a0b69825a2922818fe0dfe665d5420ab3063ff48 (patch) | |
tree | 385529b0fcbafa63f516b91b6bd9dc620f431c2e /src | |
parent | 608ed5df9f9def76ddc235b70fc54ae811e58111 (diff) | |
download | ermacs-fork-a0b69825a2922818fe0dfe665d5420ab3063ff48.tar.gz |
Moved to "msc"
Diffstat (limited to 'src')
-rw-r--r-- | src/file_gl.erl | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/file_gl.erl b/src/file_gl.erl deleted file mode 100644 index 832df73..0000000 --- a/src/file_gl.erl +++ /dev/null @@ -1,62 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : file_gl.erl -%%% Author : Luke Gorrie <luke@bluetail.com> -%%% Purpose : Group leader server for writing to a file -%%% Created : 22 Oct 2000 by Luke Gorrie <luke@bluetail.com> -%%%---------------------------------------------------------------------- - --module(file_gl). --author('luke@bluetail.com'). - --behaviour(gen_server). - -%% External exports --export([start_link/1]). - -%% gen_server callbacks --export([init/1, handle_info/2, terminate/2, code_change/3, - handle_call/3, handle_cast/2]). - --record(state, {fd}). - -%%%---------------------------------------------------------------------- -%%% API -%%%---------------------------------------------------------------------- -start_link(Filename) -> - gen_server:start_link({local, file_gl}, file_gl, Filename, []). - -%%%---------------------------------------------------------------------- -%%% Callback functions from gen_server -%%%---------------------------------------------------------------------- - -init(Filename) -> - {ok, Fd} = file:open(Filename, [write]), - {ok, #state{fd=Fd}}. - -handle_info({io_request, From, ReplyAs, {put_chars, C}}, State) -> - file:write(State#state.fd, C), - From ! {io_reply, ReplyAs, ok}, - {noreply, State}; -handle_info({io_request, From, ReplyAs, {put_chars, M, F, A}}, State) -> - file:write(State#state.fd, apply(M, F, A)), - From ! {io_reply, ReplyAs, ok}, - {noreply, State}; -handle_info({io_request, From, ReplyAs, {get_until, _, _, _}}, State) -> - From ! {io_reply, ReplyAs, eof}, - {noreply, State}; -handle_info(Info, State) -> - {noreply, State}. - -handle_call(_, _, _) -> - exit(no_such_callback). - -handle_cast(_, _) -> - exit(no_such_callback). - -terminate(Reason, State) -> - file:close(State#state.fd), - ok. - -code_change(OldVsn, State, Extra) -> - {ok, State}. - |