After some discussion on the asterisk-dev list, we determined that this approach

for extracting application, function, manager, and agi documentation is the wrong
one to take.  The most severe problem is that the output depends on which modules
are loaded as well as compile time options, which both determine which parts are
available.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72986 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2007-07-02 23:02:16 +00:00
parent df1a340774
commit d2a85e5f64
10 changed files with 0 additions and 10589 deletions

View File

@@ -1,582 +0,0 @@
% This file is automatically generated by the "manager dump actiondocs" CLI command. Any manual edits will be lost.
\section{answer}
\subsection{Summary}
\begin{verbatim}
Answer channel
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: ANSWER
Answers channel if not already in answer state. Returns -1 on
channel failure, or 0 if successful.
\end{verbatim}
\section{channel status}
\subsection{Summary}
\begin{verbatim}
Returns status of the connected channel
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: CHANNEL STATUS [<channelname>]
Returns the status of the specified channel.
If no channel name is given the returns the status of the
current channel. Return values:
0 Channel is down and available
1 Channel is down, but reserved
2 Channel is off hook
3 Digits (or equivalent) have been dialed
4 Line is ringing
5 Remote end is ringing
6 Line is up
7 Line is busy
\end{verbatim}
\section{database del}
\subsection{Summary}
\begin{verbatim}
Removes database key/value
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: DATABASE DEL <family> <key>
Deletes an entry in the Asterisk database for a
given family and key.
Returns 1 if successful, 0 otherwise.
\end{verbatim}
\section{database deltree}
\subsection{Summary}
\begin{verbatim}
Removes database keytree/value
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: DATABASE DELTREE <family> [keytree]
Deletes a family or specific keytree within a family
in the Asterisk database.
Returns 1 if successful, 0 otherwise.
\end{verbatim}
\section{database get}
\subsection{Summary}
\begin{verbatim}
Gets database value
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: DATABASE GET <family> <key>
Retrieves an entry in the Asterisk database for a
given family and key.
Returns 0 if <key> is not set. Returns 1 if <key>
is set and returns the variable in parentheses.
Example return code: 200 result=1 (testvariable)
\end{verbatim}
\section{database put}
\subsection{Summary}
\begin{verbatim}
Adds/updates database value
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: DATABASE PUT <family> <key> <value>
Adds or updates an entry in the Asterisk database for a
given family, key, and value.
Returns 1 if successful, 0 otherwise.
\end{verbatim}
\section{exec}
\subsection{Summary}
\begin{verbatim}
Executes a given Application
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: EXEC <application> <options>
Executes <application> with given <options>.
Returns whatever the application returns, or -2 on failure to find application
\end{verbatim}
\section{get data}
\subsection{Summary}
\begin{verbatim}
Prompts for DTMF on a channel
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: GET DATA <file to be streamed> [timeout] [max digits]
Stream the given file, and recieve DTMF data. Returns the digits received
from the channel at the other end.
\end{verbatim}
\section{get full variable}
\subsection{Summary}
\begin{verbatim}
Evaluates a channel expression
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: GET FULL VARIABLE <variablename> [<channel name>]
Returns 0 if <variablename> is not set or channel does not exist. Returns 1
if <variablename> is set and returns the variable in parenthesis. Understands
complex variable names and builtin variables, unlike GET VARIABLE.
example return code: 200 result=1 (testvariable)
\end{verbatim}
\section{get option}
\subsection{Summary}
\begin{verbatim}
Stream file, prompt for DTMF, with timeout
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: GET OPTION <filename> <escape_digits> [timeout]
Behaves similar to STREAM FILE but used with a timeout option.
\end{verbatim}
\section{get variable}
\subsection{Summary}
\begin{verbatim}
Gets a channel variable
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: GET VARIABLE <variablename>
Returns 0 if <variablename> is not set. Returns 1 if <variablename>
is set and returns the variable in parentheses.
example return code: 200 result=1 (testvariable)
\end{verbatim}
\section{hangup}
\subsection{Summary}
\begin{verbatim}
Hangup the current channel
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: HANGUP [<channelname>]
Hangs up the specified channel.
If no channel name is given, hangs up the current channel
\end{verbatim}
\section{noop}
\subsection{Summary}
\begin{verbatim}
Does nothing
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: NoOp
Does nothing.
\end{verbatim}
\section{receive char}
\subsection{Summary}
\begin{verbatim}
Receives one character from channels supporting it
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: RECEIVE CHAR <timeout>
Receives a character of text on a channel. Specify timeout to be the
maximum time to wait for input in milliseconds, or 0 for infinite. Most channels
do not support the reception of text. Returns the decimal value of the character
if one is received, or 0 if the channel does not support text reception. Returns
-1 only on error/hangup.
\end{verbatim}
\section{receive text}
\subsection{Summary}
\begin{verbatim}
Receives text from channels supporting it
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: RECEIVE TEXT <timeout>
Receives a string of text on a channel. Specify timeout to be the
maximum time to wait for input in milliseconds, or 0 for infinite. Most channels
do not support the reception of text. Returns -1 for failure or 1 for success, and the string in parentheses.
\end{verbatim}
\section{record file}
\subsection{Summary}
\begin{verbatim}
Records to a given file
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: RECORD FILE <filename> <format> <escape digits> <timeout> \
[offset samples] [BEEP] [s=silence]
Record to a file until a given dtmf digit in the sequence is received
Returns -1 on hangup or error. The format will specify what kind of file
will be recorded. The timeout is the maximum record time in milliseconds, or
-1 for no timeout. "Offset samples" is optional, and, if provided, will seek
to the offset without exceeding the end of the file. "silence" is the number
of seconds of silence allowed before the function returns despite the
lack of dtmf digits or reaching timeout. Silence value must be
preceeded by "s=" and is also optional.
\end{verbatim}
\section{say alpha}
\subsection{Summary}
\begin{verbatim}
Says a given character string
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SAY ALPHA <number> <escape digits>
Say a given character string, returning early if any of the given DTMF digits
are received on the channel. Returns 0 if playback completes without a digit
being pressed, or the ASCII numerical value of the digit if one was pressed or
-1 on error/hangup.
\end{verbatim}
\section{say digits}
\subsection{Summary}
\begin{verbatim}
Says a given digit string
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SAY DIGITS <number> <escape digits>
Say a given digit string, returning early if any of the given DTMF digits
are received on the channel. Returns 0 if playback completes without a digit
being pressed, or the ASCII numerical value of the digit if one was pressed or
-1 on error/hangup.
\end{verbatim}
\section{say number}
\subsection{Summary}
\begin{verbatim}
Says a given number
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SAY NUMBER <number> <escape digits> [gender]
Say a given number, returning early if any of the given DTMF digits
are received on the channel. Returns 0 if playback completes without a digit
being pressed, or the ASCII numerical value of the digit if one was pressed or
-1 on error/hangup.
\end{verbatim}
\section{say phonetic}
\subsection{Summary}
\begin{verbatim}
Says a given character string with phonetics
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SAY PHONETIC <string> <escape digits>
Say a given character string with phonetics, returning early if any of the
given DTMF digits are received on the channel. Returns 0 if playback
completes without a digit pressed, the ASCII numerical value of the digit
if one was pressed, or -1 on error/hangup.
\end{verbatim}
\section{say date}
\subsection{Summary}
\begin{verbatim}
Says a given date
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SAY DATE <date> <escape digits>
Say a given date, returning early if any of the given DTMF digits are
received on the channel. <date> is number of seconds elapsed since 00:00:00
on January 1, 1970, Coordinated Universal Time (UTC). Returns 0 if playback
completes without a digit being pressed, or the ASCII numerical value of the
digit if one was pressed or -1 on error/hangup.
\end{verbatim}
\section{say time}
\subsection{Summary}
\begin{verbatim}
Says a given time
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SAY TIME <time> <escape digits>
Say a given time, returning early if any of the given DTMF digits are
received on the channel. <time> is number of seconds elapsed since 00:00:00
on January 1, 1970, Coordinated Universal Time (UTC). Returns 0 if playback
completes without a digit being pressed, or the ASCII numerical value of the
digit if one was pressed or -1 on error/hangup.
\end{verbatim}
\section{say datetime}
\subsection{Summary}
\begin{verbatim}
Says a given time as specfied by the format given
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SAY DATETIME <time> <escape digits> [format] [timezone]
Say a given time, returning early if any of the given DTMF digits are
received on the channel. <time> is number of seconds elapsed since 00:00:00
on January 1, 1970, Coordinated Universal Time (UTC). [format] is the format
the time should be said in. See voicemail.conf (defaults to "ABdY
'digits/at' IMp"). Acceptable values for [timezone] can be found in
/usr/share/zoneinfo. Defaults to machine default. Returns 0 if playback
completes without a digit being pressed, or the ASCII numerical value of the
digit if one was pressed or -1 on error/hangup.
\end{verbatim}
\section{send image}
\subsection{Summary}
\begin{verbatim}
Sends images to channels supporting it
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SEND IMAGE <image>
Sends the given image on a channel. Most channels do not support the
transmission of images. Returns 0 if image is sent, or if the channel does not
support image transmission. Returns -1 only on error/hangup. Image names
should not include extensions.
\end{verbatim}
\section{send text}
\subsection{Summary}
\begin{verbatim}
Sends text to channels supporting it
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SEND TEXT "<text to send>"
Sends the given text on a channel. Most channels do not support the
transmission of text. Returns 0 if text is sent, or if the channel does not
support text transmission. Returns -1 only on error/hangup. Text
consisting of greater than one word should be placed in quotes since the
command only accepts a single argument.
\end{verbatim}
\section{set autohangup}
\subsection{Summary}
\begin{verbatim}
Autohangup channel in some time
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SET AUTOHANGUP <time>
Cause the channel to automatically hangup at <time> seconds in the
future. Of course it can be hungup before then as well. Setting to 0 will
cause the autohangup feature to be disabled on this channel.
\end{verbatim}
\section{set callerid}
\subsection{Summary}
\begin{verbatim}
Sets callerid for the current channel
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SET CALLERID <number>
Changes the callerid of the current channel.
\end{verbatim}
\section{set context}
\subsection{Summary}
\begin{verbatim}
Sets channel context
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SET CONTEXT <desired context>
Sets the context for continuation upon exiting the application.
\end{verbatim}
\section{set extension}
\subsection{Summary}
\begin{verbatim}
Changes channel extension
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SET EXTENSION <new extension>
Changes the extension for continuation upon exiting the application.
\end{verbatim}
\section{set music}
\subsection{Summary}
\begin{verbatim}
Enable/Disable Music on hold generator
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SET MUSIC ON <on|off> <class>
Enables/Disables the music on hold generator. If <class> is
not specified, then the default music on hold class will be used.
Always returns 0.
\end{verbatim}
\section{set priority}
\subsection{Summary}
\begin{verbatim}
Set channel dialplan priority
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SET PRIORITY <priority>
Changes the priority for continuation upon exiting the application.
The priority must be a valid priority or label.
\end{verbatim}
\section{set variable}
\subsection{Summary}
\begin{verbatim}
Sets a channel variable
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: SET VARIABLE <variablename> <value>
\end{verbatim}
\section{stream file}
\subsection{Summary}
\begin{verbatim}
Sends audio file on channel
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: STREAM FILE <filename> <escape digits> [sample offset]
Send the given file, allowing playback to be interrupted by the given
digits, if any. Use double quotes for the digits if you wish none to be
permitted. If sample offset is provided then the audio will seek to sample
offset before play starts. Returns 0 if playback completes without a digit
being pressed, or the ASCII numerical value of the digit if one was pressed,
or -1 on error or if the channel was disconnected. Remember, the file
extension must not be included in the filename.
\end{verbatim}
\section{control stream file}
\subsection{Summary}
\begin{verbatim}
Sends audio file on channel and allows the listner to control the stream
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: CONTROL STREAM FILE <filename> <escape digits> [skipms] [ffchar] [rewchr] [pausechr]
Send the given file, allowing playback to be controled by the given
digits, if any. Use double quotes for the digits if you wish none to be
permitted. Returns 0 if playback completes without a digit
being pressed, or the ASCII numerical value of the digit if one was pressed,
or -1 on error or if the channel was disconnected. Remember, the file
extension must not be included in the filename.
Note: ffchar and rewchar default to * and # respectively.
\end{verbatim}
\section{tdd mode}
\subsection{Summary}
\begin{verbatim}
Toggles TDD mode (for the deaf)
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: TDD MODE <on|off>
Enable/Disable TDD transmission/reception on a channel. Returns 1 if
successful, or 0 if channel is not TDD-capable.
\end{verbatim}
\section{verbose}
\subsection{Summary}
\begin{verbatim}
Logs a message to the asterisk verbose log
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: VERBOSE <message> <level>
Sends <message> to the console via verbose message system.
<level> is the the verbose level (1-4)
Always returns 1.
\end{verbatim}
\section{wait for digit}
\subsection{Summary}
\begin{verbatim}
Waits for a digit to be pressed
\end{verbatim}
\subsection{Usage}
\begin{verbatim}
Usage: WAIT FOR DIGIT <timeout>
Waits up to 'timeout' milliseconds for channel to receive a DTMF digit.
Returns -1 on channel failure, 0 if no digit is received in the timeout, or
the numerical value of the ascii of the digit if one is received. Use -1
for the timeout value if you desire the call to block indefinitely.
\end{verbatim}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -108,31 +108,6 @@ reference purposes.
\section{Queue Logs}
\input{queuelog.tex}
% Generate this using the "core dump clidocs" CLI command that is present
% when Asterisk is built with dev-mode enabled.
\chapter{CLI Command Reference}
\input{ast_cli_commands.tex}
% Generate this using the "core dump appdocs" CLI command that is present
% when Asterisk is built with dev-mode enabled.
\chapter{Dialplan Application Reference}
\input{ast_appdocs.tex}
% Generate this using the "core dump funcdocs" CLI command that is present
% when Asterisk is built with dev-mode enabled.
\chapter{Dialplan Function Reference}
\input{ast_funcdocs.tex}
% Generate this using the "manager dump actiondocs" CLI command that is present
% when Asterisk is built with dev-mode enabled.
\chapter{Manager Action Reference}
\input{ast_manager_actiondocs.tex}
% Generate this using the "agi dump commanddocs" CLI command that is present
% when Asterisk is built with dev-mode enabled.
\chapter{AGI Command Reference}
\input{ast_agi_commands.tex}
% This is a list of files not yet integrated into this document:
%
%Misc

View File

@@ -972,10 +972,6 @@ static struct ast_cli_entry cli_module_unload_deprecated = NEW_CLI(handle_unload
static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
#ifdef AST_DEVMODE
static char *handle_core_dump_clidocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
#endif
static struct ast_cli_entry cli_cli[] = {
/* Deprecated, but preferred command is now consolidated (and already has a deprecated command for it). */
NEW_CLI(handle_nodebugchan_deprecated, "Disable debugging on channel(s)"),
@@ -1014,10 +1010,6 @@ static struct ast_cli_entry cli_cli[] = {
{ { "soft", "hangup", NULL },
handle_softhangup, "Request a hangup on a given channel",
softhangup_help, complete_ch_3 },
#ifdef AST_DEVMODE
NEW_CLI(handle_core_dump_clidocs, "Dump CLI command documentation in LaTeX format"),
#endif
};
/*!
@@ -1458,65 +1450,6 @@ static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
return RESULT_SUCCESS;
}
#ifdef AST_DEVMODE
static char *handle_core_dump_clidocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_cli_entry *cli;
FILE *f;
const char *fn = "/tmp/ast_cli_commands.tex";
struct cli_iterator i = { NULL, NULL};
switch (cmd) {
case CLI_INIT:
e->command = "core dump clidocs";
e->usage =
"Usage: core dump clidocs\n"
" Dump CLI command documentation to /tmp/ast_cli_commands.tex.\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
if (a->argc != e->args)
return CLI_SHOWUSAGE;
if (!(f = fopen(fn, "w+"))) {
ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
return CLI_FAILURE;
}
fprintf(f, "%% This file is automatically generated by the \"core dump clidocs\" CLI command. Any manual edits will be lost.\n");
AST_LIST_LOCK(&helpers);
while ((cli = cli_next(&i))) {
/* Hide commands that start with '_' */
if (cli->_full_cmd[0] == '_')
continue;
/* Hide commands that are marked as deprecated. */
if (cli->deprecated)
continue;
fprintf(f, "\\section{%s}\n"
"\\subsection{Summary}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n"
"\\subsection{Usage}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n\n\n",
cli->_full_cmd, cli->summary, cli->usage);
}
AST_LIST_UNLOCK(&helpers);
fclose(f);
ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
return CLI_SUCCESS;
}
#endif /* AST_DEVMODE */
static char *parse_args(const char *s, int *argc, char *argv[], int max, int *trailingwhitespace)
{
char *dup, *cur;

View File

@@ -491,73 +491,6 @@ static int manager_displayconnects (struct mansession *s)
return ret;
}
#ifdef AST_DEVMODE
static char *handle_manager_dump_actiondocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct manager_action *action;
FILE *f;
char *action_name = NULL;
const char *fn = "/tmp/ast_manager_actiondocs.tex";
struct ast_str *authority = ast_str_alloca(80);
switch (cmd) {
case CLI_INIT:
e->command = "manager dump actiondocs";
e->usage =
"Usage: manager dump actiondocs [action]\n"
" Dump manager action documentation to /tmp/ast_manager_actiondocs.tex.\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
if (a->argc == e->args + 1)
action_name = a->argv[e->args];
else if (a->argc != e->args)
return CLI_SHOWUSAGE;
if (!(f = fopen(fn, "w+"))) {
ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
return CLI_FAILURE;
}
fprintf(f, "%% This file is automatically generated by the \"manager dump actiondocs\" CLI command. Any manual edits will be lost.\n");
ast_rwlock_rdlock(&actionlock);
for (action = first_action; action; action = action->next) {
if (action_name && strcasecmp(action->action, action_name))
continue;
fprintf(f, "\\section{%s}\n"
"\\subsection{Synopsis}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n"
"\\subsection{Authority}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n"
"\\subsection{Description}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n\n\n",
action->action, action->synopsis,
authority_to_str(action->authority, &authority),
action->description);
if (action_name)
break;
}
ast_rwlock_unlock(&actionlock);
fclose(f);
ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
return CLI_SUCCESS;
}
#endif /* AST_DEVMODE */
static int handle_showmancmd(int fd, int argc, char *argv[])
{
struct manager_action *cur;
@@ -775,10 +708,6 @@ static struct ast_cli_entry cli_manager[] = {
{ { "manager", "debug", NULL },
handle_mandebug, "Show, enable, disable debugging of the manager code",
"Usage: manager debug [on|off]\n Show, enable, disable debugging of the manager code.\n", NULL, NULL },
#ifdef AST_DEVMODE
NEW_CLI(handle_manager_dump_actiondocs, "Dump manager action documentation in LaTeX format"),
#endif
};
/*

View File

@@ -3153,144 +3153,6 @@ static int handle_show_application(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
#ifdef AST_DEVMODE
static char *handle_core_dump_appdocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_app *app;
FILE *f;
char *appname = NULL;
const char *fn = "/tmp/ast_appdocs.tex";
switch (cmd) {
case CLI_INIT:
e->command = "core dump appdocs";
e->usage =
"Usage: core dump appdocs [application]\n"
" Dump Application documentation to /tmp/ast_appdocs.tex.\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
if (a->argc == e->args + 1)
appname = a->argv[e->args];
else if (a->argc != e->args)
return CLI_SHOWUSAGE;
if (!(f = fopen(fn, "w+"))) {
ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
return CLI_FAILURE;
}
fprintf(f, "%% This file is automatically generated by the \"core dump appdocs\" CLI command. Any manual edits will be lost.\n");
AST_RWLIST_RDLOCK(&apps);
AST_RWLIST_TRAVERSE(&apps, app, list) {
if (appname && strcasecmp(app->name, appname))
continue;
fprintf(f, "\\section{%s}\n"
"\\subsection{Synopsis}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n"
"\\subsection{Description}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n\n\n", app->name, app->synopsis, app->description);
if (appname)
break;
}
AST_RWLIST_UNLOCK(&apps);
fclose(f);
ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
return CLI_SUCCESS;
}
static void funcdocs_write_section(FILE *f, const char *name)
{
char *section, *cur;
cur = section = alloca(strlen(name) * 2 + 1);
for (; *name; name++) {
if (*name == '_')
*cur++ = '\\';
*cur++ = *name;
}
*cur = '\0';
fprintf(f, "\\section{%s}\n", section);
}
static char *handle_core_dump_funcdocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_custom_function *acf;
FILE *f;
char *funcname = NULL;
const char *fn = "/tmp/ast_funcdocs.tex";
switch (cmd) {
case CLI_INIT:
e->command = "core dump funcdocs";
e->usage =
"Usage: core dump funcdocs [function]\n"
" Dump Application documentation to /tmp/ast_funcdocs.tex.\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
if (a->argc == e->args + 1)
funcname = a->argv[e->args];
else if (a->argc != e->args)
return CLI_SHOWUSAGE;
if (!(f = fopen(fn, "w+"))) {
ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
return CLI_FAILURE;
}
fprintf(f, "%% This file is automatically generated by the \"core dump funcdocs\" CLI command. Any manual edits will be lost.\n");
AST_RWLIST_RDLOCK(&acf_root);
AST_RWLIST_TRAVERSE(&acf_root, acf, acflist) {
if (funcname && strcasecmp(acf->name, funcname))
continue;
funcdocs_write_section(f, acf->name);
fprintf(f, "\\subsection{Syntax}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n"
"\\subsection{Synopsis}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n"
"\\subsection{Description}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n\n\n",
acf->syntax, acf->synopsis, acf->desc);
if (funcname)
break;
}
AST_RWLIST_UNLOCK(&acf_root);
fclose(f);
ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
return CLI_SUCCESS;
}
#endif
/*! \brief handle_show_hints: CLI support for listing registered dial plan hints */
static int handle_show_hints(int fd, int argc, char *argv[])
{
@@ -3957,11 +3819,6 @@ static struct ast_cli_entry pbx_cli[] = {
handle_show_application, "Describe a specific dialplan application",
show_application_help, complete_show_application },
#ifdef AST_DEVMODE
NEW_CLI(handle_core_dump_appdocs, "Dump application documentation in LaTeX format"),
NEW_CLI(handle_core_dump_funcdocs, "Dump function documentation in LaTeX format"),
#endif
{ { "core", "set", "global", NULL },
handle_set_global, "Set global dialplan variable",
set_global_help },

View File

@@ -1673,74 +1673,6 @@ static int help_workhorse(int fd, char *match[])
return 0;
}
#ifdef AST_DEVMODE
static char *handle_agi_dump_commanddocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
FILE *f;
char *command_name = NULL;
const char *fn = "/tmp/ast_agi_commands.tex";
int i;
switch (cmd) {
case CLI_INIT:
e->command = "agi dump commanddocs";
e->usage =
"Usage: agi dump commanddocs [command]\n"
" Dump manager action documentation to /tmp/ast_agi_commands.tex.\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
if (a->argc == e->args + 1)
command_name = a->argv[e->args];
else if (a->argc != e->args)
return CLI_SHOWUSAGE;
if (!(f = fopen(fn, "w+"))) {
ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
return CLI_FAILURE;
}
fprintf(f, "%% This file is automatically generated by the \"manager dump actiondocs\" CLI command. Any manual edits will be lost.\n");
/* XXX Not thread safe :( */
for (i = 0; i < ARRAY_LEN(commands); i++) {
struct agi_command *command;
char fullcmd[80];
command = &commands[i];
if (!command->cmda[0])
break;
ast_join(fullcmd, sizeof(fullcmd), command->cmda);
if (command_name && strcasecmp(fullcmd, command_name))
continue;
fprintf(f, "\\section{%s}\n"
"\\subsection{Summary}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n"
"\\subsection{Usage}\n"
"\\begin{verbatim}\n"
"%s\n"
"\\end{verbatim}\n\n\n",
fullcmd, command->summary, command->usage);
if (command_name)
break;
}
fclose(f);
ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
return CLI_SUCCESS;
}
#endif /* AST_DEVMODE */
int ast_agi_register(agi_command *agi)
{
int x;
@@ -2232,10 +2164,6 @@ static struct ast_cli_entry cli_agi[] = {
{ { "agi", "dumphtml", NULL },
handle_agidumphtml, "Dumps a list of agi commands in html format",
dumpagihtml_help },
#ifdef AST_DEVMODE
NEW_CLI(handle_agi_dump_commanddocs, "Dump agi command documentation in LaTeX format"),
#endif
};
static int unload_module(void)