added a --convert option to xmlcatalog to convert SGML ones to the XML

* include/libxml/catalog.h catalog.c xmlcatalog.c: added a
  --convert option to xmlcatalog to convert SGML ones to
  the XML syntax.
* xmllint.c: small cleanup for $SGML_CATALOG_FILES support.
Daniel
diff --git a/xmlcatalog.c b/xmlcatalog.c
index a66888d..c2cd52f 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -29,6 +29,7 @@
 static int create = 0;
 static int add = 0;
 static int del = 0;
+static int convert = 0;
 static int verbose = 0;
 static char *filename;
 
@@ -285,6 +286,8 @@
 }
 int main(int argc, char **argv) {
     int i;
+    int ret;
+
 
     if (argc <= 1) {
 	usage(argv[0]);
@@ -313,6 +316,9 @@
 	} else if ((!strcmp(argv[i], "-create")) ||
 	    (!strcmp(argv[i], "--create"))) {
 	    create++;
+	} else if ((!strcmp(argv[i], "-convert")) ||
+	    (!strcmp(argv[i], "--convert"))) {
+	    convert++;
 	} else if ((!strcmp(argv[i], "-add")) ||
 	    (!strcmp(argv[i], "--add"))) {
 	    i += 3;
@@ -340,17 +346,17 @@
 	} else if (argv[i][0] == '-')
 	    continue;
 	filename = argv[i];
-	if (!create) {
-	    xmlLoadCatalog(argv[i]);
-	} else {
+	ret = xmlLoadCatalog(argv[i]);
+	if ((ret < 0) && (create)) {
 	    xmlCatalogAdd(BAD_CAST "catalog", BAD_CAST argv[i], NULL);
 	}
 	break;
     }
 
-    if ((add) || (del)) {
-	int ret;
+    if (convert)
+        ret = xmlCatalogConvert();
 
+    if ((add) || (del)) {
 	for (i = 1; i < argc ; i++) {
 	    if (!strcmp(argv[i], "-"))
 		break;
@@ -404,7 +410,7 @@
 	    }
 	}
     }
-    if ((add) || (del) || (create)) {
+    if ((add) || (del) || (create) || (convert)) {
 	if (noout) {
 	    FILE *out;