starts to look okay, really plugged the new framework, cleaned a lot of

* catalog.c parser.c xmlIO.c xmlcatalog.c xmllint.c
  include/libxml/catalog.h: starts to look okay, really
  plugged the new framework, cleaned a lot of stuff,
  added some APIs, except the PI's support missing this
  should be mostly complete
* result/catalogs/* test/catalogs/*: added new test, enriched
  the existing one with URN ID tests
Daniel
diff --git a/xmllint.c b/xmllint.c
index ba3c48e..c04776e 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -104,6 +104,10 @@
 static int timing = 0;
 static int generate = 0;
 static struct timeval begin, end;
+#ifdef LIBXML_CATALOG_ENABLED
+static int catalogs = 0;
+static int nocatalogs = 0;
+#endif
 
 /************************************************************************
  * 									*
@@ -798,6 +802,8 @@
     printf("\t--encode encoding : output in the given encoding\n");
 #ifdef LIBXML_CATALOG_ENABLED
     printf("\t--catalogs : use the catalogs from $SGML_CATALOG_FILES\n");
+    printf("\t         otherwise /etc/xml/catalog is activated by default\n");
+    printf("\t--nocatalogs: desactivate all catalogs\n");
 #endif
     printf("\t--auto : generate a small doc on the fly\n");
 #ifdef LIBXML_XINCLUDE_ENABLED
@@ -931,14 +937,10 @@
 #ifdef LIBXML_CATALOG_ENABLED
 	else if ((!strcmp(argv[i], "-catalogs")) ||
 		 (!strcmp(argv[i], "--catalogs"))) {
-	    const char *catalogs;
-
-	    catalogs = getenv("SGML_CATALOG_FILES");
-	    if (catalogs == NULL) {
-		fprintf(stderr, "Variable $SGML_CATALOG_FILES not set\n");
-	    } else {
-		xmlLoadCatalogs(catalogs);
-	    }
+	    catalogs++;
+	} else if ((!strcmp(argv[i], "-nocatalogs")) ||
+		 (!strcmp(argv[i], "--nocatalogs"))) {
+	    nocatalogs++;
 	} 
 #endif
 	else if ((!strcmp(argv[i], "-encode")) ||
@@ -966,6 +968,17 @@
 	    return(1);
 	}
     }
+
+#ifdef LIBXML_CATALOG_ENABLED
+    if (nocatalogs == 0) {
+	if (catalogs) {
+	    const char *catal;
+
+	    catal = getenv("SGML_CATALOG_FILES");
+	    xmlLoadCatalogs(catal);
+	}
+    }
+#endif
     xmlLineNumbersDefault(1);
     if (loaddtd != 0)
 	xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS;