diff options
author | Russell Bryant <russell@russellbryant.com> | 2007-03-15 22:29:45 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2007-03-15 22:29:45 +0000 |
commit | 1cf3a12047bb358a1645892454a43dbf611253a7 (patch) | |
tree | 7e44cd7d9a574a5cc64239ef2ef9132c63946efd /main/pbx.c | |
parent | 4787adb4e9add47c2dbfac819810577483a484cb (diff) |
Merged revisions 58931 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r58931 | russell | 2007-03-15 17:25:12 -0500 (Thu, 15 Mar 2007) | 13 lines
Merge changes from svn/asterisk/team/russell/LaTeX_docs.
* Convert most of the doc directory into a single LaTeX formatted document
so that we can generate a PDF, HTML, or other formats from this
information.
* Add a CLI command to dump the application documentation into LaTeX format
which will only be include if the configure script is run with
--enable-dev-mode.
* The PDF turned out to be close to 1 MB, so it is not included. However, you
can simply run "make asterisk.pdf" to generate it yourself. We may include
it in release tarballs or have automatically generated ones on the web site,
but that has yet to be decided.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@58932 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r-- | main/pbx.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/main/pbx.c b/main/pbx.c index 042fb8b14..3e0070aa4 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -3056,6 +3056,56 @@ static int handle_show_application(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } +#ifdef AST_DEVMODE +static char core_dumpappdocs_help[] = +"Usage: core dumpappdocs [application]\n" +" Dump Application documentation to \\tmp\\ast_appdocs.tex.\n"; + +static int handle_core_dumpappdocs(int fd, int argc, char *argv[]) +{ + struct ast_app *app; + FILE *f; + char *appname = NULL; + const char *fn = "/tmp/ast_appdocs.tex"; + + if (argc > 3) + appname = argv[3]; + + if (!(f = fopen(fn, "w+"))) { + ast_cli(fd, "Unable to open %s for writing!\n", fn); + return RESULT_FAILURE; + } + + fprintf(f, "%% This file is automatically generated. Any manual edits will be lost.\n"); + + AST_LIST_LOCK(&apps); + AST_LIST_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_LIST_UNLOCK(&apps); + + fclose(f); + + ast_cli(fd, "Documentation has been dumped to %s\n", fn); + + return RESULT_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[]) { @@ -3730,6 +3780,12 @@ static struct ast_cli_entry pbx_cli[] = { handle_show_application, "Describe a specific dialplan application", show_application_help, complete_show_application }, +#ifdef AST_DEVMODE + { { "core", "dumpappdocs", NULL }, + handle_core_dumpappdocs, "Dump App docs in LaTeX format", + core_dumpappdocs_help, NULL }, +#endif + { { "core", "set", "global", NULL }, handle_set_global, "Set global dialplan variable", set_global_help }, |