[svn-commits] eliel: branch group/appdocsxml r151316 - /team/group/appdocsxml/main/pbx.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Oct 20 11:16:01 CDT 2008


Author: eliel
Date: Mon Oct 20 11:16:00 2008
New Revision: 151316

URL: http://svn.digium.com/view/asterisk?view=rev&rev=151316
Log:
If we dont find the actual language setted in documentation_language function (xx_YY) then try
to find the next like xx_* if it is not found, fallback to en_US.

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=151316&r1=151315&r2=151316
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Mon Oct 20 11:16:00 2008
@@ -831,6 +831,7 @@
 static char documentation_language[80];
 /*! \brief XML documentation tree. */
 struct documentation_tree {
+	char *language;
 	char *filename;
 	ast_xml_doc *doc;
 	AST_LIST_ENTRY(documentation_tree) entry;
@@ -6329,9 +6330,9 @@
 	ast_xml_init();
 
 	/* Get every *-LANG.xml file inside $(ASTDATADIR)/documentation */
-	ast_asprintf(&xmlpattern, "%s/documentation/*-%s.xml", ast_config_AST_DATA_DIR, documentation_language);	
+	ast_asprintf(&xmlpattern, "%s/documentation{/,/thirdparty/}*-{%.2s_??,en_US}.xml", ast_config_AST_DATA_DIR, documentation_language);
 	globbuf.gl_offs = 0;    /* initialize it to silence gcc */
-	globret = glob(xmlpattern, MY_GLOB_FLAGS, NULL, &globbuf);
+	globret = glob(xmlpattern, MY_GLOB_FLAGS | GLOB_BRACE, NULL, &globbuf);
 	if (globret == GLOB_NOSPACE) {
 		ast_log(LOG_WARNING, "Glob Expansion of pattern '%s' failed: Not enough memory\n", xmlpattern);
 		ast_free(xmlpattern);
@@ -6341,22 +6342,8 @@
 		ast_free(xmlpattern);
 		return 1;
 	}
-
-	/* Get every *-LANG.xml file inside $(ASTDATADIR)/documentation/thirdparty */
 	ast_free(xmlpattern);
-	ast_asprintf(&xmlpattern, "%s/documentation/thirdparty/*-%s.xml", ast_config_AST_DATA_DIR, documentation_language);
-	globret = glob(xmlpattern, MY_GLOB_FLAGS | GLOB_APPEND, NULL, &globbuf);
-	if (globret == GLOB_NOSPACE) {
-		ast_log(LOG_WARNING, "Glob Expansion of pattern '%s' failed: Not enough memory\n", xmlpattern);
-		ast_free(xmlpattern);
-		globfree(&globbuf);
-		return 1;
-	} else if (globret  == GLOB_ABORTED) {
-		ast_log(LOG_WARNING, "Glob Expansion of pattern '%s' failed: Read error\n", xmlpattern);
-		ast_free(xmlpattern);
-		globfree(&globbuf);
-		return 1;
-	}
+
 	AST_LIST_LOCK(&xmldoc_tree);
 	/* loop over expanded files */
 	for (i = 0; i < globbuf.gl_pathc; i++) {
@@ -6392,7 +6379,6 @@
 	AST_LIST_UNLOCK(&xmldoc_tree);
 
 	globfree(&globbuf);
-	ast_free(xmlpattern);
 
 	return 0;
 }




More information about the svn-commits mailing list