diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/cli.c | 67 | ||||
-rw-r--r-- | main/manager.c | 71 | ||||
-rw-r--r-- | main/pbx.c | 143 |
3 files changed, 0 insertions, 281 deletions
diff --git a/main/cli.c b/main/cli.c index cefee0e7e..7607793ae 100644 --- a/main/cli.c +++ b/main/cli.c @@ -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; diff --git a/main/manager.c b/main/manager.c index d1a52ba04..9ad09a906 100644 --- a/main/manager.c +++ b/main/manager.c @@ -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 }; /* diff --git a/main/pbx.c b/main/pbx.c index 0d3ebb3a3..440e58479 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -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 }, |