[svn-commits] bkruse: branch group/appdocsxml r130849 - /team/group/appdocsxml/main/pbx.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 14 15:54:20 CDT 2008


Author: bkruse
Date: Mon Jul 14 15:54:19 2008
New Revision: 130849

URL: http://svn.digium.com/view/asterisk?view=rev&rev=130849
Log:
Fix the file open locations

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=130849&r1=130848&r2=130849
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Mon Jul 14 15:54:19 2008
@@ -112,7 +112,7 @@
 
 /* Don't know what this should be. */
 /* XXX: make this configurable */
-#define FILE_XML_DOC "/usr/share/asterisk/core-en.xml"
+#define FILE_XML_DOC "core-en.xml"
 
 AST_APP_OPTIONS(background_opts, {
 	AST_APP_OPTION('s', BACKGROUND_SKIP),
@@ -4583,17 +4583,21 @@
 static int ast_load_documentation(void) {
 
 	FILE *xmldoc;
-	//const char *test;
-	//mxml_node_t *node, *tmp;
+	char *path;
+
+	/* This memory is automagically freed */
+	path = alloca(strlen(ast_config_AST_DATA_DIR) + strlen(FILE_XML_DOC));
+	sprintf(path, "%s/%s", ast_config_AST_DATA_DIR, FILE_XML_DOC);
 
 	/* For now, I just throw away cdata */
-	xmldoc = fopen(FILE_XML_DOC, "r");
+	xmldoc = fopen(path, "r");
 
 	mxmlSetErrorCallback(_mxml_error);
 
 	if (!xmldoc) {
-		ast_log(LOG_ERROR, "Could not open XML Doc at '%s'\n", FILE_XML_DOC);
+		ast_log(LOG_ERROR, "Could not open XML Doc at '%s'\n", path);
 		documentation_tree = NULL;
+		fclose(xmldoc);
 		return 1;
 	}
 




More information about the svn-commits mailing list