aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-15 22:25:12 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-15 22:25:12 +0000
commit3bc7e211a435c49aa70ad227799bd7b0c40356a1 (patch)
treed8e5262f1e1a9faad716b36f59a6b3fe65c288bd /main
parenta63acaa328b9937677f3f5c4d861889a6e369034 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@58931 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/pbx.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 203a057f6..0bdd29baa 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -3202,6 +3202,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 registred dial plan hints */
static int handle_show_hints(int fd, int argc, char *argv[])
{
@@ -3788,6 +3838,12 @@ static struct ast_cli_entry pbx_cli[] = {
handle_show_application, "Describe a specific dialplan application",
show_application_help, complete_show_application, &cli_show_application_deprecated },
+#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, NULL, &cli_set_global_deprecated },