mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-02-05 05:47:00 +03:00
Fixed SGML catalogs breakage of 2.4.7, added a couple of really needed
* include/libxml/catalog.h catalog.c: Fixed SGML catalogs breakage of 2.4.7, added a couple of really needed APIs like xmlCatalogIsEmpty() and xmlNewCatalog() * xmlcatalog.c: updated --sgml --noout to be a suitable replacement for install-catalog * configure.in: preparing 2.4.8 Daniel
This commit is contained in:
parent
5a37bde34b
commit
cd21dc7848
@ -1,3 +1,12 @@
|
|||||||
|
Sun Nov 4 20:56:53 CET 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* include/libxml/catalog.h catalog.c: Fixed SGML catalogs
|
||||||
|
breakage of 2.4.7, added a couple of really needed APIs
|
||||||
|
like xmlCatalogIsEmpty() and xmlNewCatalog()
|
||||||
|
* xmlcatalog.c: updated --sgml --noout to be a suitable replacement
|
||||||
|
for install-catalog
|
||||||
|
* configure.in: preparing 2.4.8
|
||||||
|
|
||||||
Thu Nov 1 15:29:31 CET 2001 Daniel Veillard <daniel@veillard.com>
|
Thu Nov 1 15:29:31 CET 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* HTMLtree.c tree.c include/libxml/HTMLtree.h
|
* HTMLtree.c tree.c include/libxml/HTMLtree.h
|
||||||
|
79
catalog.c
79
catalog.c
@ -302,7 +302,7 @@ xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlNewCatalog:
|
* xmlCreateNewCatalog:
|
||||||
* @type: type of catalog
|
* @type: type of catalog
|
||||||
* @prefer: the PUBLIC vs. SYSTEM current preference value
|
* @prefer: the PUBLIC vs. SYSTEM current preference value
|
||||||
*
|
*
|
||||||
@ -312,7 +312,7 @@ xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) {
|
|||||||
* Returns the xmlCatalogPtr or NULL in case of error
|
* Returns the xmlCatalogPtr or NULL in case of error
|
||||||
*/
|
*/
|
||||||
static xmlCatalogPtr
|
static xmlCatalogPtr
|
||||||
xmlNewCatalog(xmlCatalogType type, xmlCatalogPrefer prefer) {
|
xmlCreateNewCatalog(xmlCatalogType type, xmlCatalogPrefer prefer) {
|
||||||
xmlCatalogPtr ret;
|
xmlCatalogPtr ret;
|
||||||
|
|
||||||
ret = (xmlCatalogPtr) xmlMalloc(sizeof(xmlCatalog));
|
ret = (xmlCatalogPtr) xmlMalloc(sizeof(xmlCatalog));
|
||||||
@ -326,6 +326,8 @@ xmlNewCatalog(xmlCatalogType type, xmlCatalogPrefer prefer) {
|
|||||||
ret->catalNr = 0;
|
ret->catalNr = 0;
|
||||||
ret->catalMax = XML_MAX_SGML_CATA_DEPTH;
|
ret->catalMax = XML_MAX_SGML_CATA_DEPTH;
|
||||||
ret->prefer = prefer;
|
ret->prefer = prefer;
|
||||||
|
if (ret->type == XML_SGML_CATALOG_TYPE)
|
||||||
|
ret->sgml = xmlHashCreate(10);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2353,7 +2355,7 @@ xmlLoadSGMLSuperCatalog(const char *filename)
|
|||||||
if (content == NULL)
|
if (content == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
catal = xmlNewCatalog(XML_SGML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
|
catal = xmlCreateNewCatalog(XML_SGML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
|
||||||
if (catal == NULL) {
|
if (catal == NULL) {
|
||||||
xmlFree(content);
|
xmlFree(content);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -2400,7 +2402,7 @@ xmlLoadACatalog(const char *filename)
|
|||||||
first++;
|
first++;
|
||||||
|
|
||||||
if (*first != '<') {
|
if (*first != '<') {
|
||||||
catal = xmlNewCatalog(XML_SGML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
|
catal = xmlCreateNewCatalog(XML_SGML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
|
||||||
if (catal == NULL) {
|
if (catal == NULL) {
|
||||||
xmlFree(content);
|
xmlFree(content);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -2412,7 +2414,7 @@ xmlLoadACatalog(const char *filename)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
catal = xmlNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
|
catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
|
||||||
if (catal == NULL) {
|
if (catal == NULL) {
|
||||||
xmlFree(content);
|
xmlFree(content);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -2630,7 +2632,7 @@ xmlACatalogResolveURI(xmlCatalogPtr catal, const xmlChar *URI) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xmlACatalogDump(xmlCatalogPtr catal, FILE *out) {
|
xmlACatalogDump(xmlCatalogPtr catal, FILE *out) {
|
||||||
if (out == NULL)
|
if ((out == NULL) || (catal == NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (catal->type == XML_XML_CATALOG_TYPE) {
|
if (catal->type == XML_XML_CATALOG_TYPE) {
|
||||||
@ -2673,6 +2675,8 @@ xmlACatalogAdd(xmlCatalogPtr catal, const xmlChar * type,
|
|||||||
|
|
||||||
entry = xmlNewCatalogEntry(cattype, orig, replace,
|
entry = xmlNewCatalogEntry(cattype, orig, replace,
|
||||||
XML_CATA_PREFER_NONE);
|
XML_CATA_PREFER_NONE);
|
||||||
|
if (catal->sgml == NULL)
|
||||||
|
catal->sgml = xmlHashCreate(10);
|
||||||
res = xmlHashAddEntry(catal->sgml, orig, entry);
|
res = xmlHashAddEntry(catal->sgml, orig, entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2706,6 +2710,65 @@ xmlACatalogRemove(xmlCatalogPtr catal, const xmlChar *value) {
|
|||||||
return(res);
|
return(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlNewCatalog:
|
||||||
|
* @sgml: should this create an SGML catalog
|
||||||
|
*
|
||||||
|
* create a new Catalog.
|
||||||
|
*
|
||||||
|
* Returns the xmlCatalogPtr or NULL in case of error
|
||||||
|
*/
|
||||||
|
xmlCatalogPtr
|
||||||
|
xmlNewCatalog(int sgml) {
|
||||||
|
xmlCatalogPtr catal = NULL;
|
||||||
|
|
||||||
|
if (sgml) {
|
||||||
|
catal = xmlCreateNewCatalog(XML_SGML_CATALOG_TYPE,
|
||||||
|
xmlCatalogDefaultPrefer);
|
||||||
|
if ((catal != NULL) && (catal->sgml == NULL))
|
||||||
|
catal->sgml = xmlHashCreate(10);
|
||||||
|
} else
|
||||||
|
catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
|
||||||
|
xmlCatalogDefaultPrefer);
|
||||||
|
return(catal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlCatalogIsEmpty:
|
||||||
|
* @catal: should this create an SGML catalog
|
||||||
|
*
|
||||||
|
* Check is a catalog is empty
|
||||||
|
*
|
||||||
|
* Returns 1 if the catalog is empty, 0 if not, amd -1 in case of error.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xmlCatalogIsEmpty(xmlCatalogPtr catal) {
|
||||||
|
if (catal == NULL)
|
||||||
|
return(-1);
|
||||||
|
|
||||||
|
if (catal->type == XML_XML_CATALOG_TYPE) {
|
||||||
|
if (catal->xml == NULL)
|
||||||
|
return(1);
|
||||||
|
if ((catal->xml->type != XML_CATA_CATALOG) &&
|
||||||
|
(catal->xml->type != XML_CATA_BROKEN_CATALOG))
|
||||||
|
return(-1);
|
||||||
|
if (catal->xml->children == NULL)
|
||||||
|
return(1);
|
||||||
|
return(0);
|
||||||
|
} else {
|
||||||
|
int res;
|
||||||
|
|
||||||
|
if (catal->sgml == NULL)
|
||||||
|
return(1);
|
||||||
|
res = xmlHashSize(catal->sgml);
|
||||||
|
if (res == 0)
|
||||||
|
return(1);
|
||||||
|
if (res < 0)
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Public interfaces manipulating the global shared default catalog *
|
* Public interfaces manipulating the global shared default catalog *
|
||||||
@ -2757,7 +2820,7 @@ xmlInitializeCatalog(void) {
|
|||||||
if (catalogs == NULL)
|
if (catalogs == NULL)
|
||||||
catalogs = XML_XML_DEFAULT_CATALOG;
|
catalogs = XML_XML_DEFAULT_CATALOG;
|
||||||
|
|
||||||
catal = xmlNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
|
catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
|
||||||
if (catal != NULL) {
|
if (catal != NULL) {
|
||||||
|
|
||||||
catal->xml = xmlNewCatalogEntry(XML_CATA_CATALOG,
|
catal->xml = xmlNewCatalogEntry(XML_CATA_CATALOG,
|
||||||
@ -2996,7 +3059,7 @@ xmlCatalogAdd(const xmlChar *type, const xmlChar *orig, const xmlChar *replace)
|
|||||||
*/
|
*/
|
||||||
if ((xmlDefaultCatalog == NULL) &&
|
if ((xmlDefaultCatalog == NULL) &&
|
||||||
(xmlStrEqual(type, BAD_CAST "catalog"))) {
|
(xmlStrEqual(type, BAD_CAST "catalog"))) {
|
||||||
xmlDefaultCatalog = xmlNewCatalog(XML_XML_CATALOG_TYPE,
|
xmlDefaultCatalog = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
|
||||||
xmlCatalogDefaultPrefer);
|
xmlCatalogDefaultPrefer);
|
||||||
xmlDefaultCatalog->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
|
xmlDefaultCatalog->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
|
||||||
orig, xmlCatalogDefaultPrefer);
|
orig, xmlCatalogDefaultPrefer);
|
||||||
|
@ -6,7 +6,7 @@ AC_CANONICAL_HOST
|
|||||||
|
|
||||||
LIBXML_MAJOR_VERSION=2
|
LIBXML_MAJOR_VERSION=2
|
||||||
LIBXML_MINOR_VERSION=4
|
LIBXML_MINOR_VERSION=4
|
||||||
LIBXML_MICRO_VERSION=7
|
LIBXML_MICRO_VERSION=8
|
||||||
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
|
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
|
||||||
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
|
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ typedef xmlCatalog *xmlCatalogPtr;
|
|||||||
/*
|
/*
|
||||||
* Operations on a given catalog
|
* Operations on a given catalog
|
||||||
*/
|
*/
|
||||||
|
xmlCatalogPtr xmlNewCatalog (int sgml);
|
||||||
xmlCatalogPtr xmlLoadACatalog (const char *filename);
|
xmlCatalogPtr xmlLoadACatalog (const char *filename);
|
||||||
xmlCatalogPtr xmlLoadSGMLSuperCatalog (const char *filename);
|
xmlCatalogPtr xmlLoadSGMLSuperCatalog (const char *filename);
|
||||||
int xmlConvertSGMLCatalog (xmlCatalogPtr catal);
|
int xmlConvertSGMLCatalog (xmlCatalogPtr catal);
|
||||||
@ -81,6 +82,7 @@ xmlChar * xmlACatalogResolveURI (xmlCatalogPtr catal,
|
|||||||
void xmlACatalogDump (xmlCatalogPtr catal,
|
void xmlACatalogDump (xmlCatalogPtr catal,
|
||||||
FILE *out);
|
FILE *out);
|
||||||
void xmlFreeCatalog (xmlCatalogPtr catal);
|
void xmlFreeCatalog (xmlCatalogPtr catal);
|
||||||
|
int xmlCatalogIsEmpty (xmlCatalogPtr catal);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global operations
|
* Global operations
|
||||||
|
@ -46,6 +46,10 @@ URI library.
|
|||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|
||||||
|
* Sun Nov 4 2001 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
- 2.4.7 broke SGML catalogs badly. this fixes it.
|
||||||
|
|
||||||
* Thu Apr 26 2001 Toshio Kuratomi <badger@prtr-13.ucsc.edu>
|
* Thu Apr 26 2001 Toshio Kuratomi <badger@prtr-13.ucsc.edu>
|
||||||
|
|
||||||
[2.3.7]
|
[2.3.7]
|
||||||
|
114
xmlcatalog.c
114
xmlcatalog.c
@ -15,6 +15,9 @@
|
|||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBREADLINE
|
#ifdef HAVE_LIBREADLINE
|
||||||
#include <readline/readline.h>
|
#include <readline/readline.h>
|
||||||
@ -40,6 +43,9 @@ static int verbose = 0;
|
|||||||
static char *filename;
|
static char *filename;
|
||||||
|
|
||||||
#ifdef LIBXML_CATALOG_ENABLED
|
#ifdef LIBXML_CATALOG_ENABLED
|
||||||
|
|
||||||
|
#define XML_SGML_DEFAULT_CATALOG "/etc/sgml/catalog"
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Shell Interface *
|
* Shell Interface *
|
||||||
@ -291,13 +297,14 @@ static void usershell(void) {
|
|||||||
static void usage(const char *name) {
|
static void usage(const char *name) {
|
||||||
printf("Usage : %s [options] catalogfile entities...\n", name);
|
printf("Usage : %s [options] catalogfile entities...\n", name);
|
||||||
printf("\tParse the catalog file and query it for the entities\n");
|
printf("\tParse the catalog file and query it for the entities\n");
|
||||||
printf("\t--sgml : handle an SGML Super catalog\n");
|
printf("\t--sgml : handle SGML Super catalogs for --add and --del\n");
|
||||||
printf("\t--shell : run a shell allowing interactive queries\n");
|
printf("\t--shell : run a shell allowing interactive queries\n");
|
||||||
printf("\t--create : create a new catalog\n");
|
printf("\t--create : create a new catalog\n");
|
||||||
printf("\t--add 'type' 'orig' 'replace' : add an entry\n");
|
printf("\t--add 'type' 'orig' 'replace' : add an entry\n");
|
||||||
printf("\t--del 'values' : remove values\n");
|
printf("\t--del 'values' : remove values\n");
|
||||||
printf("\t--noout: avoid dumping the result on stdout\n");
|
printf("\t--noout: avoid dumping the result on stdout\n");
|
||||||
printf("\t used with add or del, it saves the catalog changes\n");
|
printf("\t used with add or del, it saves the catalog changes\n");
|
||||||
|
printf("\t and with --sgml it also updates the super catalog\n");
|
||||||
printf("\t-v --verbose : provide debug informations\n");
|
printf("\t-v --verbose : provide debug informations\n");
|
||||||
}
|
}
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@ -341,7 +348,7 @@ int main(int argc, char **argv) {
|
|||||||
} else if ((!strcmp(argv[i], "-add")) ||
|
} else if ((!strcmp(argv[i], "-add")) ||
|
||||||
(!strcmp(argv[i], "--add"))) {
|
(!strcmp(argv[i], "--add"))) {
|
||||||
if (sgml)
|
if (sgml)
|
||||||
i += 1;
|
i += 2;
|
||||||
else
|
else
|
||||||
i += 3;
|
i += 3;
|
||||||
add++;
|
add++;
|
||||||
@ -360,7 +367,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((!strcmp(argv[i], "-add")) ||
|
if ((!strcmp(argv[i], "-add")) ||
|
||||||
(!strcmp(argv[i], "--add"))) {
|
(!strcmp(argv[i], "--add"))) {
|
||||||
if (sgml)
|
if (sgml)
|
||||||
i += 1;
|
i += 2;
|
||||||
else
|
else
|
||||||
i += 3;
|
i += 3;
|
||||||
continue;
|
continue;
|
||||||
@ -371,15 +378,12 @@ int main(int argc, char **argv) {
|
|||||||
} else if (argv[i][0] == '-')
|
} else if (argv[i][0] == '-')
|
||||||
continue;
|
continue;
|
||||||
filename = argv[i];
|
filename = argv[i];
|
||||||
/* !!!!!!!!!!!!!!!!!! TODO !!!!
|
if (!sgml) {
|
||||||
if (sgml)
|
|
||||||
ret = xmlLoadSGMLSuperCatalog(argv[i]);
|
|
||||||
else
|
|
||||||
!!!!!!!!! */
|
|
||||||
ret = xmlLoadCatalog(argv[i]);
|
ret = xmlLoadCatalog(argv[i]);
|
||||||
if ((!sgml) && (ret < 0) && (create)) {
|
if ((ret < 0) && (create)) {
|
||||||
xmlCatalogAdd(BAD_CAST "catalog", BAD_CAST argv[i], NULL);
|
xmlCatalogAdd(BAD_CAST "catalog", BAD_CAST argv[i], NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,13 +397,93 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (argv[i][0] != '-')
|
if (argv[i][0] != '-')
|
||||||
continue;
|
continue;
|
||||||
|
if (strcmp(argv[i], "-add") && strcmp(argv[i], "--add") &&
|
||||||
|
strcmp(argv[i], "-del") && strcmp(argv[i], "--del"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (sgml) {
|
||||||
|
/*
|
||||||
|
* Maintainance of SGML catalogs.
|
||||||
|
*/
|
||||||
|
xmlCatalogPtr catal = NULL;
|
||||||
|
xmlCatalogPtr super = NULL;
|
||||||
|
|
||||||
|
catal = xmlLoadSGMLSuperCatalog(argv[i + 1]);
|
||||||
|
|
||||||
if ((!strcmp(argv[i], "-add")) ||
|
if ((!strcmp(argv[i], "-add")) ||
|
||||||
(!strcmp(argv[i], "--add"))) {
|
(!strcmp(argv[i], "--add"))) {
|
||||||
if (sgml) {
|
if (catal == NULL)
|
||||||
ret = xmlCatalogAdd(BAD_CAST "sgmlcatalog", NULL,
|
catal = xmlNewCatalog(1);
|
||||||
BAD_CAST argv[i + 1]);
|
super = xmlLoadSGMLSuperCatalog(XML_SGML_DEFAULT_CATALOG);
|
||||||
i += 1;
|
if (super == NULL)
|
||||||
|
super = xmlNewCatalog(1);
|
||||||
|
|
||||||
|
xmlACatalogAdd(catal, BAD_CAST "CATALOG",
|
||||||
|
BAD_CAST argv[i + 2], NULL);
|
||||||
|
xmlACatalogAdd(super, BAD_CAST "CATALOG",
|
||||||
|
BAD_CAST argv[i + 1], NULL);
|
||||||
} else {
|
} else {
|
||||||
|
if (catal != NULL)
|
||||||
|
ret = xmlACatalogRemove(catal, BAD_CAST argv[i + 2]);
|
||||||
|
else
|
||||||
|
ret = -1;
|
||||||
|
if (ret < 0)
|
||||||
|
fprintf(stderr, "Failed to removed entry from %s\n",
|
||||||
|
argv[i + 1]);
|
||||||
|
if ((noout) && (catal != NULL) &&
|
||||||
|
(xmlCatalogIsEmpty(catal))) {
|
||||||
|
super = xmlLoadSGMLSuperCatalog(
|
||||||
|
XML_SGML_DEFAULT_CATALOG);
|
||||||
|
if (super != NULL) {
|
||||||
|
ret = xmlACatalogRemove(super,
|
||||||
|
BAD_CAST argv[i + 1]);
|
||||||
|
if (ret < 0)
|
||||||
|
fprintf(stderr,
|
||||||
|
"Failed to removed entry from %s\n",
|
||||||
|
XML_SGML_DEFAULT_CATALOG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (noout) {
|
||||||
|
FILE *out;
|
||||||
|
|
||||||
|
if (xmlCatalogIsEmpty(catal)) {
|
||||||
|
unlink(argv[i + 1]);
|
||||||
|
} else {
|
||||||
|
out = fopen(argv[i + 1], "w");
|
||||||
|
if (out == NULL) {
|
||||||
|
fprintf(stderr, "could not open %s for saving\n",
|
||||||
|
argv[i + 1]);
|
||||||
|
noout = 0;
|
||||||
|
} else {
|
||||||
|
xmlACatalogDump(catal, out);
|
||||||
|
fclose(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (super != NULL) {
|
||||||
|
if (xmlCatalogIsEmpty(super)) {
|
||||||
|
unlink(XML_SGML_DEFAULT_CATALOG);
|
||||||
|
} else {
|
||||||
|
out = fopen(XML_SGML_DEFAULT_CATALOG, "w");
|
||||||
|
if (out == NULL) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"could not open %s for saving\n",
|
||||||
|
XML_SGML_DEFAULT_CATALOG);
|
||||||
|
noout = 0;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
xmlACatalogDump(super, out);
|
||||||
|
fclose(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xmlACatalogDump(catal, stdout);
|
||||||
|
}
|
||||||
|
i += 2;
|
||||||
|
} else {
|
||||||
|
if ((!strcmp(argv[i], "-add")) ||
|
||||||
|
(!strcmp(argv[i], "--add"))) {
|
||||||
if ((argv[i + 3] == NULL) || (argv[i + 3][0] == 0))
|
if ((argv[i + 3] == NULL) || (argv[i + 3][0] == 0))
|
||||||
ret = xmlCatalogAdd(BAD_CAST argv[i + 1], NULL,
|
ret = xmlCatalogAdd(BAD_CAST argv[i + 1], NULL,
|
||||||
BAD_CAST argv[i + 2]);
|
BAD_CAST argv[i + 2]);
|
||||||
@ -410,13 +494,13 @@ int main(int argc, char **argv) {
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
printf("add command failed\n");
|
printf("add command failed\n");
|
||||||
i += 3;
|
i += 3;
|
||||||
}
|
|
||||||
} else if ((!strcmp(argv[i], "-del")) ||
|
} else if ((!strcmp(argv[i], "-del")) ||
|
||||||
(!strcmp(argv[i], "--del"))) {
|
(!strcmp(argv[i], "--del"))) {
|
||||||
ret = xmlCatalogRemove(BAD_CAST argv[i + 1]);
|
ret = xmlCatalogRemove(BAD_CAST argv[i + 1]);
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else if (shell) {
|
} else if (shell) {
|
||||||
usershell();
|
usershell();
|
||||||
@ -446,7 +530,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((add) || (del) || (create) || (convert)) {
|
if ((!sgml) && ((add) || (del) || (create) || (convert))) {
|
||||||
if (noout) {
|
if (noout) {
|
||||||
FILE *out;
|
FILE *out;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user