1c(3)                       Erlang Module Definition                       c(3)
2
3
4

NAME

6       c - Command interface module.
7

DESCRIPTION

9       This module enables users to enter the short form of some commonly used
10       commands.
11
12   Note:
13       These functions are intended for interactive use in  the  Erlang  shell
14       only. The module prefix can be omitted.
15
16

EXPORTS

18       bt(Pid) -> ok | undefined
19
20              Types:
21
22                 Pid = pid()
23
24              Stack backtrace for a process. Equivalent to erlang:process_dis‐
25              play(Pid, backtrace).
26
27       c(Module) -> {ok, ModuleName} | error
28
29              Types:
30
31                 Module = file:name()
32                 ModuleName = module()
33
34              Works like c(Module, []).
35
36       c(Module, Options) -> {ok, ModuleName} | error
37
38              Types:
39
40                 Module = file:name()
41                 Options = [compile:option()] | compile:option()
42                 ModuleName = module()
43
44              Compiles and then purges and loads the code for a module. Module
45              can be either a module name or a source file path, with or with‐
46              out .erl extension.
47
48              If Module is a string, it is assumed to be a source  file  path,
49              and  the  compiler  will attempt to compile the source file with
50              the options Options. If compilation fails, the old  object  file
51              (if any) is deleted.
52
53              If Module is an atom, a source file with that exact name or with
54              .erl extension will be looked for. If found, the source file  is
55              compiled with the options Options. If compilation fails, the old
56              object file (if any) is deleted.
57
58              If Module is an atom and is not the path of a source file,  then
59              the code path is searched to locate the object file for the mod‐
60              ule and extract its original compiler options and  source  path.
61              If  the  source  file  is  not  found  in the original location,
62              filelib:find_source/1 is used to search for it relative  to  the
63              directory of the object file.
64
65              The  source  file  is compiled with the the original options ap‐
66              pended to the given Options, the output replacing the old object
67              file if and only if compilation succeeds.
68
69              Notice  that purging the code means that any processes lingering
70              in old code for the module are killed without warning. For  more
71              information, see the code module.
72
73       c(Module, Options, Filter) -> {ok, ModuleName} | error
74
75              Types:
76
77                 Module = atom()
78                 Options = [compile:option()]
79                 Filter = fun((compile:option()) -> boolean())
80                 ModuleName = module()
81
82              Compiles  and  then purges and loads the code for module Module,
83              which must be an atom.
84
85              The code path is searched to locate the object file  for  module
86              Module  and  extract  its  original  compiler options and source
87              path. If the source file is not found in the original  location,
88              filelib:find_source/1  is  used to search for it relative to the
89              directory of the object file.
90
91              The source file is compiled with the the  original  options  ap‐
92              pended to the given Options, the output replacing the old object
93              file if and only if compilation succeeds.  The  function  Filter
94              specifies  which  elements  to remove from the original compiler
95              options before the new options are added. The Filter fun  should
96              return  true  for  options to keep, and false for options to re‐
97              move.
98
99              Notice that purging the code means that any processes  lingering
100              in  old code for the module are killed without warning. For more
101              information, see the code module.
102
103       cd(Dir) -> ok
104
105              Types:
106
107                 Dir = file:name()
108
109              Changes working directory to Dir, which can be a relative  name,
110              and then prints the name of the new working directory.
111
112              Example:
113
114              2> cd("../erlang").
115              /home/ron/erlang
116
117       erlangrc(PathList) -> {ok, file:filename()} | {error, term()}
118
119              Types:
120
121                 PathList = [Dir :: file:name()]
122
123              Search PathList and load .erlang resource file if found.
124
125       flush() -> ok
126
127              Flushes any messages sent to the shell.
128
129       help() -> ok
130
131              Displays  help  information:  all valid shell internal commands,
132              and commands in this module.
133
134       h(Module :: module()) -> h_return()
135
136              Types:
137
138                 h_return() =
139                     ok | {error, missing | {unknown_format, unicode:chardata()}}
140
141              Print the documentation for Module
142
143       h(Module :: module(), Function :: function()) -> hf_return()
144
145              Types:
146
147                 h_return() =
148                     ok | {error, missing | {unknown_format, unicode:chardata()}}
149                 hf_return() = h_return() | {error, function_missing}
150
151              Print the documentation for all Module:Functions (regardless  of
152              arity).
153
154       h(Module :: module(), Function :: function(), Arity :: arity()) ->
155            hf_return()
156
157              Types:
158
159                 h_return() =
160                     ok | {error, missing | {unknown_format, unicode:chardata()}}
161                 hf_return() = h_return() | {error, function_missing}
162
163              Print the documentation for Module:Function/Arity.
164
165       hcb(Module :: module()) -> h_return()
166
167              Types:
168
169                 h_return() =
170                     ok | {error, missing | {unknown_format, unicode:chardata()}}
171
172              Print the callback documentation for Module
173
174       hcb(Module :: module(), Callback :: atom()) -> hcb_return()
175
176              Types:
177
178                 h_return() =
179                     ok | {error, missing | {unknown_format, unicode:chardata()}}
180                 hcb_return() = h_return() | {error, callback_missing}
181
182              Print  the  callback documentation for all Module:Callbacks (re‐
183              gardless of arity).
184
185       hcb(Module :: module(), Callback :: atom(), Arity :: arity()) ->
186              hcb_return()
187
188              Types:
189
190                 h_return() =
191                     ok | {error, missing | {unknown_format, unicode:chardata()}}
192                 hcb_return() = h_return() | {error, callback_missing}
193
194              Print the callback documentation for Module:Callback/Arity.
195
196       ht(Module :: module()) -> h_return()
197
198              Types:
199
200                 h_return() =
201                     ok | {error, missing | {unknown_format, unicode:chardata()}}
202
203              Print the type documentation for Module
204
205       ht(Module :: module(), Type :: atom()) -> ht_return()
206
207              Types:
208
209                 h_return() =
210                     ok | {error, missing | {unknown_format, unicode:chardata()}}
211                 ht_return() = h_return() | {error, type_missing}
212
213              Print the type documentation for Type in  Module  regardless  of
214              arity.
215
216       ht(Module :: module(), Type :: atom(), Arity :: arity()) ->
217             ht_return()
218
219              Types:
220
221                 h_return() =
222                     ok | {error, missing | {unknown_format, unicode:chardata()}}
223                 ht_return() = h_return() | {error, type_missing}
224
225              Print the type documentation for Type/Arity in Module.
226
227       i() -> ok
228
229       ni() -> ok
230
231              i/0  displays  system information, listing information about all
232              processes. ni/0 does the same, but for all nodes the network.
233
234       i(X, Y, Z) -> [{atom(), term()}]
235
236              Types:
237
238                 X = Y = Z = integer() >= 0
239
240              Displays   information   about   a   process,   Equivalent    to
241              process_info(pid(X, Y, Z)), but location transparent.
242
243       l(Module) -> code:load_ret()
244
245              Types:
246
247                 Module = module()
248
249              Purges   and   loads,   or   reloads,   a   module   by  calling
250              code:purge(Module) followed by code:load_file(Module).
251
252              Notice that purging the code means that any processes  lingering
253              in  old code for the module are killed without warning. For more
254              information, see code/3.
255
256       lc(Files) -> ok
257
258              Types:
259
260                 Files = [File]
261                 File
262
263              Compiles a list of  files  by  calling  compile:file(File,  [re‐
264              port_errors, report_warnings]) for each File in Files.
265
266              For information about File, see file:filename().
267
268       lm() -> [code:load_ret()]
269
270              Reloads  all  currently loaded modules that have changed on disk
271              (see mm()). Returns the list of results from  calling  l(M)  for
272              each such M.
273
274       ls() -> ok
275
276              Lists files in the current directory.
277
278       ls(Dir) -> ok
279
280              Types:
281
282                 Dir = file:name()
283
284              Lists  files  in  directory Dir or, if Dir is a file, only lists
285              it.
286
287       m() -> ok
288
289              Displays information about the  loaded  modules,  including  the
290              files from which they have been loaded.
291
292       m(Module) -> ok
293
294              Types:
295
296                 Module = module()
297
298              Displays information about Module.
299
300       mm() -> [module()]
301
302              Lists  all  modified  modules.  Shorthand for code:modified_mod‐
303              ules/0.
304
305       memory() -> [{Type, Size}]
306
307              Types:
308
309                 Type = atom()
310                 Size = integer() >= 0
311
312              Memory allocation information. Equivalent to erlang:memory/0.
313
314       memory(Type) -> Size
315
316       memory(Types) -> [{Type, Size}]
317
318              Types:
319
320                 Types = [Type]
321                 Type = atom()
322                 Size = integer() >= 0
323
324              Memory allocation information. Equivalent to erlang:memory/1.
325
326       nc(File) -> {ok, Module} | error
327
328       nc(File, Options) -> {ok, Module} | error
329
330              Types:
331
332                 File = file:name()
333                 Options = [Option] | Option
334                 Option = compile:option()
335                 Module = module()
336
337              Compiles and then loads the code for a file on  all  nodes.  Op‐
338              tions defaults to []. Compilation is equivalent to:
339
340              compile:file(File, Options ++ [report_errors, report_warnings])
341
342       nl(Module) -> abcast | error
343
344              Types:
345
346                 Module = module()
347
348              Loads Module on all nodes.
349
350       pid(X, Y, Z) -> pid()
351
352              Types:
353
354                 X = Y = Z = integer() >= 0
355
356              Converts  X,  Y,  Z  to pid <X.Y.Z>. This function is only to be
357              used when debugging.
358
359       pwd() -> ok
360
361              Prints the name of the working directory.
362
363       q() -> no_return()
364
365              This function is shorthand for init:stop(), that is,  it  causes
366              the node to stop in a controlled fashion.
367
368       regs() -> ok
369
370       nregs() -> ok
371
372              regs/0  displays  information  about  all  registered processes.
373              nregs/0 does the same, but for all nodes in the network.
374
375       uptime() -> ok
376
377              Prints  the  node  uptime  (as   specified   by   erlang:statis‐
378              tics(wall_clock)) in human-readable form.
379
380       xm(ModSpec) -> void()
381
382              Types:
383
384                 ModSpec = Module | Filename
385                  Module = atom()
386                  Filename = string()
387
388              Finds undefined functions, unused functions, and calls to depre‐
389              cated functions in a module by calling xref:m/1.
390
391       y(File) -> YeccRet
392
393              Types:
394
395                 File = name()
396                 YeccRet
397
398              Generates an LALR-1 parser. Equivalent to:
399
400              yecc:file(File)
401
402              For information about File = name(), see filename(3). For infor‐
403              mation about YeccRet, see yecc:file/2.
404
405       y(File, Options) -> YeccRet
406
407              Types:
408
409                 File = name()
410                 Options, YeccRet
411
412              Generates an LALR-1 parser. Equivalent to:
413
414              yecc:file(File, Options)
415
416              For information about File = name(), see filename(3). For infor‐
417              mation about Options and YeccRet, see yecc:file/2.
418

SEE ALSO

420       filename(3), compile(3), erlang(3), yecc(3), xref(3)
421
422
423
424Ericsson AB                       stdlib 4.2                              c(3)
Impressum