[asterisk-commits] bkruse: branch group/appdocsxml r132192 - /team/group/appdocsxml/main/pbx.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 18 15:24:53 CDT 2008
Author: bkruse
Date: Fri Jul 18 15:24:53 2008
New Revision: 132192
URL: http://svn.digium.com/view/asterisk?view=rev&rev=132192
Log:
Make everything build, still no where near working.
Will work on this later tonight
Modified:
team/group/appdocsxml/main/pbx.c
Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=132192&r1=132191&r2=132192
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Fri Jul 18 15:24:53 2008
@@ -341,7 +341,7 @@
#ifdef XML_DOCUMENTATION
mxml_node_t *documentation_tree = NULL;
static char *ast_mxml_get_field(const char *type, const char *name, const char *var);
-static char *ast_mxml_build_syntax(const char *type, const char *name, const char *var);
+static char *ast_mxml_build_syntax(const char *type, const char *name);
void _mxml_error(const char *cb);
#endif
@@ -2783,13 +2783,11 @@
return cur ? 0 : -1;
}
-static char *ast_mxml_build_syntax(const char *type, const char *name, const char *var) {
+static char *ast_mxml_build_syntax(const char *type, const char *name) {
const char *tmp = NULL;
- char *val = NULL;
- char *req = NULL;
int req_found = 1;
- mxml_node_t *node, *ret;
+ mxml_node_t *node, *ret, *req;
node = ret = NULL;
@@ -2807,7 +2805,7 @@
for (node = mxmlFindElement(documentation_tree, documentation_tree, type, "name", name, MXML_DESCEND); node != NULL && node->child != NULL; node = mxmlFindElement(node, documentation_tree, type, "name", name, MXML_DESCEND)) {
tmp = mxmlElementGetAttr(node, "language");
if (!strcmp(tmp, documentation_language)) {
- ret = mxmlFindElement(node, documentation_tree, var, NULL, NULL, MXML_DESCEND_FIRST);
+ ret = mxmlFindElement(node, documentation_tree, NULL, NULL, NULL, MXML_DESCEND_FIRST);
break;
}
}
@@ -2819,8 +2817,8 @@
for (ret = mxmlFindElement(node, documentation_tree, "option", NULL, NULL, MXML_DESCEND); ret != NULL; ret = mxmlFindElement(ret, documentation_tree, "option", NULL, NULL, MXML_DESCEND)) {
if (!req_found) {
- req = mxmlElementGetAttr(ret, "required");
- if (req && (!ast_strlen_zero(req))) {
+ tmp = mxmlElementGetAttr(ret, "required");
+ if (tmp && (!ast_strlen_zero(tmp))) {
/* We found the "required=true" node. Set the req pointer to ret (current node) */
req = ret;
req_found = 0;
@@ -2830,7 +2828,7 @@
}
if (!ret || !ret->child) {
- ast_log(LOG_WARNING, "Cannot find varible '%s' in tree '%s'\n", name, var);
+ ast_log(LOG_WARNING, "Cannot find option variables in tree '%s'\n", name);
return NULL;
}
@@ -4833,6 +4831,7 @@
return NULL;
case CLI_GENERATE:
/* return the n-th [partial] matching entry */
+ wordlen = strlen(a->word);
AST_RWLIST_RDLOCK(&apps);
AST_RWLIST_TRAVERSE(&apps, aa, list) {
if (!strncasecmp(a->word, aa->name, wordlen) && ++which > a->n) {
@@ -4857,7 +4856,7 @@
if (!strcasecmp(aa->name, a->argv[app])) {
/* Maximum number of characters added by terminal coloring is 22 */
char infotitle[64 + AST_MAX_APP + 22], syntitle[40], destitle[40], taxtitle[40];
- char info[64 + AST_MAX_APP], *synopsis = NULL, *description = NULL, *syntax = NULL;
+ char info[64 + AST_MAX_APP], *synopsis = NULL, *description = NULL, *syntax = NULL, *syn_handle;
int synopsis_size, description_size, syntax_size;
no_registered_app = 0;
@@ -4873,6 +4872,11 @@
else
description_size = strlen("Not available") + 23;
description = alloca(description_size);
+
+ /* XXX Figure out how much space we REALLY need */
+ syntax_size = (4096 + 23);
+ syntax = alloca(syntax_size);
+ syn_handle = ast_mxml_build_syntax("application", aa->name);
if (synopsis && description) {
snprintf(info, 64 + AST_MAX_APP, "\n -= Syntax representation of App: '%s' =- \n\n", aa->name);
@@ -4887,7 +4891,7 @@
aa->description ? aa->description : "Not available",
COLOR_CYAN, 0, description_size);
term_color(syntax,
- aa->description ? aa->description : "Not available",
+ syn_handle ? syn_handle : "Not available",
COLOR_CYAN, 0, syntax_size);
More information about the asterisk-commits
mailing list