summaryrefslogtreecommitdiff
path: root/catalog.c
diff options
context:
space:
mode:
authorIgor Zlatkovic <igor@src.gnome.org>2002-10-04 13:32:49 +0000
committerIgor Zlatkovic <igor@src.gnome.org>2002-10-04 13:32:49 +0000
commit124ec318f86384f3fb1c8bf05c212c12ebbbe323 (patch)
treebcdad747e3bcde266b1120c6fa5cb0b40a78a798 /catalog.c
parent043620e1cbee6d76781811803e6468640c273ce4 (diff)
downloadlibxml2-124ec318f86384f3fb1c8bf05c212c12ebbbe323.tar.gz
fixed lists in XML_CATALOG_FILES
Diffstat (limited to 'catalog.c')
-rw-r--r--catalog.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/catalog.c b/catalog.c
index 1fc419d7..a548c039 100644
--- a/catalog.c
+++ b/catalog.c
@@ -2837,18 +2837,39 @@ xmlInitializeCatalog(void) {
if (xmlDefaultCatalog == NULL) {
const char *catalogs;
+ char *path;
+ const char *cur, *paths;
xmlCatalogPtr catal;
+ xmlCatalogEntryPtr *nextent;
catalogs = (const char *) getenv("XML_CATALOG_FILES");
if (catalogs == NULL)
catalogs = XML_XML_DEFAULT_CATALOG;
- catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
+ catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
+ xmlCatalogDefaultPrefer);
if (catal != NULL) {
-
- catal->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
- NULL, BAD_CAST catalogs, xmlCatalogDefaultPrefer);
-
+ /* the XML_CATALOG_FILES envvar is allowed to contain a
+ space-separated list of entries. */
+ cur = catalogs;
+ nextent = &catal->xml;
+ while (*cur != '\0') {
+ while (IS_BLANK(*cur))
+ cur++;
+ if (*cur != 0) {
+ paths = cur;
+ while ((*cur != 0) && (!IS_BLANK(*cur)))
+ cur++;
+ path = xmlStrndup((const xmlChar *)paths, cur - paths);
+ if (path != NULL) {
+ *nextent = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
+ NULL, BAD_CAST path, xmlCatalogDefaultPrefer);
+ if (*nextent != NULL)
+ nextent = &((*nextent)->next);
+ xmlFree(path);
+ }
+ }
+ }
xmlDefaultCatalog = catal;
}
}
@@ -2896,7 +2917,7 @@ xmlLoadCatalog(const char *filename)
/**
* xmlLoadCatalogs:
- * @paths: a list of file path separated by ':' or spaces
+ * @paths: a space-separated list of catalog files.
*
* Load the catalogs and makes their definitions effective for the default
* external entity loader.
@@ -2917,7 +2938,7 @@ xmlLoadCatalogs(const char *pathss) {
while (IS_BLANK(*cur)) cur++;
if (*cur != 0) {
paths = cur;
- while ((*cur != 0) && (*cur != ':') && (!IS_BLANK(*cur)))
+ while ((*cur != 0) && (!IS_BLANK(*cur)))
cur++;
path = xmlStrndup((const xmlChar *)paths, cur - paths);
if (path != NULL) {
@@ -2925,8 +2946,6 @@ xmlLoadCatalogs(const char *pathss) {
xmlFree(path);
}
}
- while (*cur == ':')
- cur++;
}
}