.TH c 3erl "stdlib 5.2" "Ericsson AB" "Erlang Module Definition" .SH NAME c \- Command interface module. .SH DESCRIPTION .LP This module enables users to enter the short form of some commonly used commands\&. .LP .RS -4 .B Note: .RE These functions are intended for interactive use in the Erlang shell only\&. The module prefix can be omitted\&. .SH EXPORTS .LP .nf .B bt(Pid) -> ok | undefined .br .fi .br .RS .LP Types: .RS 3 Pid = pid() .br .RE .RE .RS .LP Stack backtrace for a process\&. Equivalent to \fIerlang:process_display(Pid, backtrace)\fR\&\&. .RE .LP .nf .B c(Module) -> {ok, ModuleName} | error .br .fi .br .RS .LP Types: .RS 3 Module = file:name() .br ModuleName = module() .br .RE .RE .RS .LP Works like \fIc(Module, [])\fR\&\&. .RE .LP .nf .B c(Module, Options) -> {ok, ModuleName} | error .br .fi .br .RS .LP Types: .RS 3 Module = file:name() .br Options = [compile:option()] | compile:option() .br ModuleName = module() .br .RE .RE .RS .LP Compiles and then purges and loads the code for a module\&. \fIModule\fR\& can be either a module name or a source file path, with or without \fI\&.erl\fR\& extension\&. .LP If \fIModule\fR\& is a string, it is assumed to be a source file path, and the compiler will attempt to compile the source file with the options \fIOptions\fR\&\&. If compilation fails, the old object file (if any) is deleted\&. .LP If \fIModule\fR\& is an atom, a source file with that exact name or with \fI\&.erl\fR\& extension will be looked for\&. If found, the source file is compiled with the options \fIOptions\fR\&\&. If compilation fails, the old object file (if any) is deleted\&. .LP If \fIModule\fR\& is an atom and is not the path of a source file, then the code path is searched to locate the object file for the module and extract its original compiler options and source path\&. If the source file is not found in the original location, \fIfilelib:find_source/1\fR\& is used to search for it relative to the directory of the object file\&. .LP The source file is compiled with the the original options appended to the given \fIOptions\fR\&, the output replacing the old object file if and only if compilation succeeds\&. .LP Notice that purging the code means that any processes lingering in old code for the module are killed without warning\&. For more information, see the code module\&. .RE .LP .nf .B c(Module, Options, Filter) -> {ok, ModuleName} | error .br .fi .br .RS .LP Types: .RS 3 Module = atom() .br Options = [compile:option()] .br Filter = fun((compile:option()) -> boolean()) .br ModuleName = module() .br .RE .RE .RS .LP Compiles and then purges and loads the code for module \fIModule\fR\&, which must be an atom\&. .LP The code path is searched to locate the object file for module \fIModule\fR\& and extract its original compiler options and source path\&. If the source file is not found in the original location, \fIfilelib:find_source/1\fR\& is used to search for it relative to the directory of the object file\&. .LP The source file is compiled with the the original options appended to the given \fIOptions\fR\&, the output replacing the old object file if and only if compilation succeeds\&. The function \fIFilter\fR\& specifies which elements to remove from the original compiler options before the new options are added\&. The \fIFilter\fR\& fun should return \fItrue\fR\& for options to keep, and \fIfalse\fR\& for options to remove\&. .LP Notice that purging the code means that any processes lingering in old code for the module are killed without warning\&. For more information, see the code module\&. .RE .LP .nf .B cd(Dir) -> ok .br .fi .br .RS .LP Types: .RS 3 Dir = file:name() .br .RE .RE .RS .LP Changes working directory to \fIDir\fR\&, which can be a relative name, and then prints the name of the new working directory\&. .LP \fIExample:\fR\& .LP .nf 2> cd("\&.\&./erlang")\&. /home/ron/erlang .fi .RE .LP .nf .B erlangrc(PathList) -> {ok, file:filename()} | {error, term()} .br .fi .br .RS .LP Types: .RS 3 PathList = [Dir :: file:name()] .br .RE .RE .RS .LP Search \fIPathList\fR\& and load \fI\&.erlang\fR\& resource file if found\&. .RE .LP .nf .B flush() -> ok .br .fi .br .RS .LP Flushes any messages sent to the shell\&. .RE .LP .nf .B help() -> ok .br .fi .br .RS .LP Displays help information: all valid shell internal commands, and commands in this module\&. .RE .LP .nf .B h(Module :: module()) -> h_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .RE .RE .RS .LP Print the documentation for \fIModule\fR\& .RE .LP .nf .B h(Module :: module(), Function :: function()) -> hf_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .nf \fBhf_return()\fR\& = h_return() | {error, function_missing} .fi .br .RE .RE .RS .LP Print the documentation for all \fIModule:Function\fR\&s (regardless of arity)\&. .RE .LP .nf .B h(Module :: module(), Function :: function(), Arity :: arity()) -> .B hf_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .nf \fBhf_return()\fR\& = h_return() | {error, function_missing} .fi .br .RE .RE .RS .LP Print the documentation for \fIModule:Function/Arity\fR\&\&. .RE .LP .nf .B hcb(Module :: module()) -> h_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .RE .RE .RS .LP Print the callback documentation for \fIModule\fR\& .RE .LP .nf .B hcb(Module :: module(), Callback :: atom()) -> hcb_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .nf \fBhcb_return()\fR\& = h_return() | {error, callback_missing} .fi .br .RE .RE .RS .LP Print the callback documentation for all \fIModule:Callback\fR\&s (regardless of arity)\&. .RE .LP .nf .B hcb(Module :: module(), Callback :: atom(), Arity :: arity()) -> .B hcb_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .nf \fBhcb_return()\fR\& = h_return() | {error, callback_missing} .fi .br .RE .RE .RS .LP Print the callback documentation for \fIModule:Callback/Arity\fR\&\&. .RE .LP .nf .B ht(Module :: module()) -> h_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .RE .RE .RS .LP Print the type documentation for \fIModule\fR\& .RE .LP .nf .B ht(Module :: module(), Type :: atom()) -> ht_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .nf \fBht_return()\fR\& = h_return() | {error, type_missing} .fi .br .RE .RE .RS .LP Print the type documentation for \fIType\fR\& in \fIModule\fR\& regardless of arity\&. .RE .LP .nf .B ht(Module :: module(), Type :: atom(), Arity :: arity()) -> .B ht_return() .br .fi .br .RS .LP Types: .RS 3 .nf \fBh_return()\fR\& = .br ok | {error, missing | {unknown_format, unicode:chardata()}} .fi .br .nf \fBht_return()\fR\& = h_return() | {error, type_missing} .fi .br .RE .RE .RS .LP Print the type documentation for \fIType/Arity\fR\& in \fIModule\fR\&\&. .RE .LP .nf .B i() -> ok .br .fi .br .nf .B ni() -> ok .br .fi .br .RS .LP \fIi/0\fR\& displays system information, listing information about all processes\&. \fIni/0\fR\& does the same, but for all nodes in the network\&. .RE .LP .nf .B i(X, Y, Z) -> [{atom(), term()}] .br .fi .br .RS .LP Types: .RS 3 X = Y = Z = integer() >= 0 .br .RE .RE .RS .LP Displays information about a process, Equivalent to \fIprocess_info(pid(X, Y, Z))\fR\&, but location transparent\&. .RE .LP .nf .B l(Module) -> code:load_ret() .br .fi .br .RS .LP Types: .RS 3 Module = module() .br .RE .RE .RS .LP Purges and loads, or reloads, a module by calling \fIcode:purge(Module)\fR\& followed by \fIcode:load_file(Module)\fR\&\&. .LP Notice that purging the code means that any processes lingering in old code for the module are killed without warning\&. For more information, see \fIcode/3\fR\&\&. .RE .LP .B lc(Files) -> ok .br .RS .LP Types: .RS 3 Files = [File] .br File .br .RE .RE .RS .LP Compiles a list of files by calling \fIcompile:file(File, [report_errors, report_warnings])\fR\& for each \fIFile\fR\& in \fIFiles\fR\&\&. .LP For information about \fIFile\fR\&, see \fIfile:filename()\fR\&\&. .RE .LP .nf .B lm() -> [code:load_ret()] .br .fi .br .RS .LP Reloads all currently loaded modules that have changed on disk (see \fImm()\fR\&)\&. Returns the list of results from calling \fIl(M)\fR\& for each such \fIM\fR\&\&. .RE .LP .nf .B ls() -> ok .br .fi .br .RS .LP Lists files in the current directory\&. .RE .LP .nf .B ls(Dir) -> ok .br .fi .br .RS .LP Types: .RS 3 Dir = file:name() .br .RE .RE .RS .LP Lists files in directory \fIDir\fR\& or, if \fIDir\fR\& is a file, only lists it\&. .RE .LP .nf .B m() -> ok .br .fi .br .RS .LP Displays information about the loaded modules, including the files from which they have been loaded\&. .RE .LP .nf .B m(Module) -> ok .br .fi .br .RS .LP Types: .RS 3 Module = module() .br .RE .RE .RS .LP Displays information about \fIModule\fR\&\&. .RE .LP .nf .B mm() -> [module()] .br .fi .br .RS .LP Lists all modified modules\&. Shorthand for \fIcode:modified_modules/0\fR\&\&. .RE .LP .nf .B memory() -> [{Type, Size}] .br .fi .br .RS .LP Types: .RS 3 Type = atom() .br Size = integer() >= 0 .br .RE .RE .RS .LP Memory allocation information\&. Equivalent to \fIerlang:memory/0\fR\&\&. .RE .LP .nf .B memory(Type) -> Size .br .fi .br .nf .B memory(Types) -> [{Type, Size}] .br .fi .br .RS .LP Types: .RS 3 Types = [Type] .br Type = atom() .br Size = integer() >= 0 .br .RE .RE .RS .LP Memory allocation information\&. Equivalent to \fIerlang:memory/1\fR\&\&. .RE .LP .nf .B nc(File) -> {ok, Module} | error .br .fi .br .nf .B nc(File, Options) -> {ok, Module} | error .br .fi .br .RS .LP Types: .RS 3 File = file:name() .br Options = [Option] | Option .br Option = compile:option() .br Module = module() .br .RE .RE .RS .LP Compiles and then loads the code for a file on all nodes\&. \fIOptions\fR\& defaults to \fI[]\fR\&\&. Compilation is equivalent to: .LP .nf compile:file(File, Options ++ [report_errors, report_warnings]) .fi .RE .LP .nf .B nl(Module) -> abcast | error .br .fi .br .RS .LP Types: .RS 3 Module = module() .br .RE .RE .RS .LP Loads \fIModule\fR\& on all nodes\&. .RE .LP .nf .B pid(X, Y, Z) -> pid() .br .fi .br .RS .LP Types: .RS 3 X = Y = Z = integer() >= 0 .br .RE .RE .RS .LP Converts \fIX\fR\&, \fIY\fR\&, \fIZ\fR\& to pid \fI\fR\&\&. This function is only to be used when debugging\&. .RE .LP .nf .B pwd() -> ok .br .fi .br .RS .LP Prints the name of the working directory\&. .RE .LP .nf .B q() -> no_return() .br .fi .br .RS .LP This function is shorthand for \fIinit:stop()\fR\&, that is, it causes the node to stop in a controlled fashion\&. .RE .LP .nf .B regs() -> ok .br .fi .br .nf .B nregs() -> ok .br .fi .br .RS .LP \fIregs/0\fR\& displays information about all registered processes\&. \fInregs/0\fR\& does the same, but for all nodes in the network\&. .RE .LP .nf .B uptime() -> ok .br .fi .br .RS .LP Prints the node uptime (as specified by \fIerlang:statistics(wall_clock)\fR\&) in human-readable form\&. .RE .LP .B xm(ModSpec) -> void() .br .RS .LP Types: .RS 3 ModSpec = Module | Filename .br Module = atom() .br Filename = string() .br .RE .RE .RS .LP Finds undefined functions, unused functions, and calls to deprecated functions in a module by calling \fIxref:m/1\fR\&\&. .RE .LP .B y(File) -> YeccRet .br .RS .LP Types: .RS 3 File = name() .br YeccRet .br .RE .RE .RS .LP Generates an LALR-1 parser\&. Equivalent to: .LP .nf yecc:file(File) .fi .LP For information about \fIFile = name()\fR\&, see \fIfilename(3erl)\fR\&\&. For information about \fIYeccRet\fR\&, see \fIyecc:file/2\fR\&\&. .RE .LP .B y(File, Options) -> YeccRet .br .RS .LP Types: .RS 3 File = name() .br Options, YeccRet .br .RE .RE .RS .LP Generates an LALR-1 parser\&. Equivalent to: .LP .nf yecc:file(File, Options) .fi .LP For information about \fIFile = name()\fR\&, see \fIfilename(3erl)\fR\&\&. For information about \fIOptions\fR\& and \fIYeccRet\fR\&, see \fIyecc:file/2\fR\&\&. .RE .SH "SEE ALSO" .LP \fIfilename(3erl)\fR\&, \fIcompile(3erl)\fR\&, \fIerlang(3erl)\fR\&, \fIyecc(3erl)\fR\&, \fIxref(3erl)\fR\&