blob: e0828faa52005e8b69b6c75def423abf4af37aea [file] [log] [blame]
Daniel Veillard344cee72001-08-20 00:08:40 +00001/*
2 * xmlcatalog.c : a small utility program to handle XML catalogs
3 *
4 * See Copyright for the status of this software.
5 *
6 * daniel@veillard.com
7 */
8
9#include "libxml.h"
10
11#include <string.h>
12#include <stdio.h>
13#include <stdarg.h>
14
Daniel Veillardc0631a62001-09-20 13:56:06 +000015#ifdef HAVE_STDLIB_H
16#include <stdlib.h>
17#endif
18
Bjorn Reese45029602001-08-21 09:23:53 +000019#ifdef HAVE_LIBREADLINE
20#include <readline/readline.h>
21#ifdef HAVE_LIBHISTORY
22#include <readline/history.h>
23#endif
24#endif
25
Daniel Veillard344cee72001-08-20 00:08:40 +000026#include <libxml/xmlmemory.h>
27#include <libxml/uri.h>
28#include <libxml/catalog.h>
29#include <libxml/parser.h>
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000030#include <libxml/globals.h>
Daniel Veillard344cee72001-08-20 00:08:40 +000031
32static int shell = 0;
Daniel Veillard82d75332001-10-08 15:01:59 +000033static int sgml = 0;
Daniel Veillard344cee72001-08-20 00:08:40 +000034static int noout = 0;
Daniel Veillarde7ead2d2001-08-22 23:44:09 +000035static int create = 0;
Daniel Veillardcda96922001-08-21 10:56:31 +000036static int add = 0;
37static int del = 0;
Daniel Veillard6c5f9d12001-08-25 13:33:14 +000038static int convert = 0;
Daniel Veillard344cee72001-08-20 00:08:40 +000039static int verbose = 0;
Daniel Veillardcda96922001-08-21 10:56:31 +000040static char *filename;
Daniel Veillard344cee72001-08-20 00:08:40 +000041
42#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardcd21dc72001-11-04 20:03:38 +000043
44#define XML_SGML_DEFAULT_CATALOG "/etc/sgml/catalog"
45
Daniel Veillard344cee72001-08-20 00:08:40 +000046/************************************************************************
47 * *
48 * Shell Interface *
49 * *
50 ************************************************************************/
51/**
52 * xmlShellReadline:
53 * @prompt: the prompt value
54 *
55 * Read a string
56 *
57 * Returns a pointer to it or NULL on EOF the caller is expected to
58 * free the returned string.
59 */
60static char *
61xmlShellReadline(const char *prompt) {
62#ifdef HAVE_LIBREADLINE
63 char *line_read;
64
65 /* Get a line from the user. */
66 line_read = readline (prompt);
67
68 /* If the line has any text in it, save it on the history. */
69 if (line_read && *line_read)
70 add_history (line_read);
71
72 return (line_read);
73#else
74 char line_read[501];
Daniel Veillard572577e2002-01-18 16:23:55 +000075 char *ret;
76 int len;
Daniel Veillard344cee72001-08-20 00:08:40 +000077
78 if (prompt != NULL)
79 fprintf(stdout, "%s", prompt);
80 if (!fgets(line_read, 500, stdin))
81 return(NULL);
82 line_read[500] = 0;
Daniel Veillard572577e2002-01-18 16:23:55 +000083 len = strlen(line_read);
84 ret = (char *) malloc(len + 1);
85 if (ret != NULL) {
86 memcpy (ret, line_read, len + 1);
87 }
88 return(ret);
Daniel Veillard344cee72001-08-20 00:08:40 +000089#endif
90}
91
Daniel Veillard344cee72001-08-20 00:08:40 +000092static void usershell(void) {
93 char *cmdline = NULL, *cur;
94 int nbargs;
95 char command[100];
96 char arg[400];
Daniel Veillardcda96922001-08-21 10:56:31 +000097 char *argv[20];
98 int i, ret;
Daniel Veillardcda96922001-08-21 10:56:31 +000099 xmlChar *ans;
Daniel Veillard344cee72001-08-20 00:08:40 +0000100
101 while (1) {
102 cmdline = xmlShellReadline("> ");
103 if (cmdline == NULL)
104 return;
105
106 /*
107 * Parse the command itself
108 */
109 cur = cmdline;
110 nbargs = 0;
111 while ((*cur == ' ') || (*cur == '\t')) cur++;
112 i = 0;
113 while ((*cur != ' ') && (*cur != '\t') &&
114 (*cur != '\n') && (*cur != '\r')) {
115 if (*cur == 0)
116 break;
117 command[i++] = *cur++;
118 }
119 command[i] = 0;
120 if (i == 0) continue;
121 nbargs++;
122
123 /*
Daniel Veillardcda96922001-08-21 10:56:31 +0000124 * Parse the argument string
Daniel Veillard344cee72001-08-20 00:08:40 +0000125 */
Daniel Veillardcda96922001-08-21 10:56:31 +0000126 memset(arg, 0, sizeof(arg));
Daniel Veillard344cee72001-08-20 00:08:40 +0000127 while ((*cur == ' ') || (*cur == '\t')) cur++;
128 i = 0;
129 while ((*cur != '\n') && (*cur != '\r') && (*cur != 0)) {
130 if (*cur == 0)
131 break;
132 arg[i++] = *cur++;
133 }
134 arg[i] = 0;
135 if (i != 0)
136 nbargs++;
137
138 /*
Daniel Veillardcda96922001-08-21 10:56:31 +0000139 * Parse the arguments
140 */
141 i = 0;
142 nbargs = 0;
143 cur = arg;
144 memset(argv, 0, sizeof(argv));
145 while (*cur != 0) {
146 while ((*cur == ' ') || (*cur == '\t')) cur++;
147 if (*cur == '\'') {
148 cur++;
149 argv[i] = cur;
150 while ((*cur != 0) && (*cur != '\'')) cur++;
151 if (*cur == '\'') {
152 *cur = 0;
153 nbargs++;
154 i++;
155 cur++;
156 }
157 } else if (*cur == '"') {
158 cur++;
159 argv[i] = cur;
160 while ((*cur != 0) && (*cur != '"')) cur++;
161 if (*cur == '"') {
162 *cur = 0;
163 nbargs++;
164 i++;
165 cur++;
166 }
167 } else {
168 argv[i] = cur;
169 while ((*cur != 0) && (*cur != ' ') && (*cur != '\t'))
170 cur++;
171 *cur = 0;
172 nbargs++;
173 i++;
174 cur++;
175 }
176 }
177
178 /*
Daniel Veillard344cee72001-08-20 00:08:40 +0000179 * start interpreting the command
180 */
181 if (!strcmp(command, "exit"))
182 break;
183 if (!strcmp(command, "quit"))
184 break;
185 if (!strcmp(command, "bye"))
186 break;
187 if (!strcmp(command, "public")) {
Daniel Veillardcda96922001-08-21 10:56:31 +0000188 if (nbargs != 1) {
189 printf("public requires 1 arguments\n");
Daniel Veillard344cee72001-08-20 00:08:40 +0000190 } else {
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000191 ans = xmlCatalogResolvePublic((const xmlChar *) argv[0]);
192 if (ans == NULL) {
Daniel Veillardcda96922001-08-21 10:56:31 +0000193 printf("No entry for PUBLIC %s\n", argv[0]);
194 } else {
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000195 printf("%s\n", ans);
196 xmlFree(ans);
Daniel Veillardcda96922001-08-21 10:56:31 +0000197 }
Daniel Veillard344cee72001-08-20 00:08:40 +0000198 }
199 } else if (!strcmp(command, "system")) {
Daniel Veillardcda96922001-08-21 10:56:31 +0000200 if (nbargs != 1) {
201 printf("system requires 1 arguments\n");
Daniel Veillard344cee72001-08-20 00:08:40 +0000202 } else {
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000203 ans = xmlCatalogResolveSystem((const xmlChar *) argv[0]);
204 if (ans == NULL) {
Daniel Veillardcda96922001-08-21 10:56:31 +0000205 printf("No entry for SYSTEM %s\n", argv[0]);
206 } else {
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000207 printf("%s\n", ans);
208 xmlFree(ans);
Daniel Veillardcda96922001-08-21 10:56:31 +0000209 }
210 }
211 } else if (!strcmp(command, "add")) {
Daniel Veillard82d75332001-10-08 15:01:59 +0000212 if (sgml) {
213 if (nbargs != 1) {
214 printf("add requires 1 argument\n");
215 } else {
216 ret = xmlCatalogAdd(BAD_CAST "sgmlcatalog", NULL,
217 BAD_CAST argv[0]);
218 }
Daniel Veillardcda96922001-08-21 10:56:31 +0000219 } else {
Daniel Veillard82d75332001-10-08 15:01:59 +0000220 if ((nbargs != 3) && (nbargs != 2)) {
221 printf("add requires 2 or 3 arguments\n");
222 } else {
223 if (argv[2] == NULL)
224 ret = xmlCatalogAdd(BAD_CAST argv[0], NULL,
225 BAD_CAST argv[1]);
226 else
227 ret = xmlCatalogAdd(BAD_CAST argv[0], BAD_CAST argv[1],
228 BAD_CAST argv[2]);
229 if (ret != 0)
230 printf("add command failed\n");
231 }
Daniel Veillardcda96922001-08-21 10:56:31 +0000232 }
233 } else if (!strcmp(command, "del")) {
234 if (nbargs != 1) {
235 printf("del requires 1\n");
236 } else {
237 ret = xmlCatalogRemove(BAD_CAST argv[0]);
238 if (ret <= 0)
239 printf("del command failed\n");
240
241 }
242 } else if (!strcmp(command, "resolve")) {
243 if (nbargs != 2) {
244 printf("resolve requires 2 arguments\n");
245 } else {
246 ans = xmlCatalogResolve(BAD_CAST argv[0],
247 BAD_CAST argv[1]);
248 if (ans == NULL) {
249 printf("Resolver failed to find an answer\n");
250 } else {
251 printf("%s\n", ans);
252 xmlFree(ans);
253 }
Daniel Veillard344cee72001-08-20 00:08:40 +0000254 }
255 } else if (!strcmp(command, "dump")) {
Daniel Veillardcda96922001-08-21 10:56:31 +0000256 if (nbargs != 0) {
257 printf("dump has no arguments\n");
258 } else {
259 xmlCatalogDump(stdout);
260 }
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000261 } else if (!strcmp(command, "debug")) {
262 if (nbargs != 0) {
263 printf("debug has no arguments\n");
264 } else {
265 verbose++;
266 xmlCatalogSetDebug(verbose);
267 }
268 } else if (!strcmp(command, "quiet")) {
269 if (nbargs != 0) {
270 printf("quiet has no arguments\n");
271 } else {
272 if (verbose > 0)
273 verbose--;
274 xmlCatalogSetDebug(verbose);
275 }
Daniel Veillard344cee72001-08-20 00:08:40 +0000276 } else {
277 if (strcmp(command, "help")) {
278 printf("Unrecognized command %s\n", command);
279 }
280 printf("Commands available:\n");
281 printf("\tpublic PublicID: make a PUBLIC identifier lookup\n");
282 printf("\tsystem SystemID: make a SYSTEM identifier lookup\n");
Daniel Veillardcda96922001-08-21 10:56:31 +0000283 printf("\tresolve PublicID SystemID: do a full resolver lookup\n");
284 printf("\tadd 'type' 'orig' 'replace' : add an entry\n");
285 printf("\tdel 'values' : remove values\n");
Daniel Veillard344cee72001-08-20 00:08:40 +0000286 printf("\tdump: print the current catalog state\n");
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000287 printf("\tdebug: increase the verbosity level\n");
288 printf("\tquiet: decrease the verbosity level\n");
Daniel Veillard344cee72001-08-20 00:08:40 +0000289 printf("\texit: quit the shell\n");
290 }
291 free(cmdline); /* not xmlFree here ! */
292 }
293}
294
295/************************************************************************
296 * *
297 * Main *
298 * *
299 ************************************************************************/
300static void usage(const char *name) {
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000301 printf("Usage : %s [options] catalogfile entities...\n", name);
302 printf("\tParse the catalog file and query it for the entities\n");
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000303 printf("\t--sgml : handle SGML Super catalogs for --add and --del\n");
Daniel Veillard344cee72001-08-20 00:08:40 +0000304 printf("\t--shell : run a shell allowing interactive queries\n");
Daniel Veillarde7ead2d2001-08-22 23:44:09 +0000305 printf("\t--create : create a new catalog\n");
Daniel Veillardcda96922001-08-21 10:56:31 +0000306 printf("\t--add 'type' 'orig' 'replace' : add an entry\n");
307 printf("\t--del 'values' : remove values\n");
308 printf("\t--noout: avoid dumping the result on stdout\n");
309 printf("\t used with add or del, it saves the catalog changes\n");
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000310 printf("\t and with --sgml it also updates the super catalog\n");
Daniel Veillard344cee72001-08-20 00:08:40 +0000311 printf("\t-v --verbose : provide debug informations\n");
312}
313int main(int argc, char **argv) {
314 int i;
Daniel Veillard6c5f9d12001-08-25 13:33:14 +0000315 int ret;
316
Daniel Veillard344cee72001-08-20 00:08:40 +0000317
318 if (argc <= 1) {
319 usage(argv[0]);
320 return(1);
321 }
322
323 LIBXML_TEST_VERSION
324 for (i = 1; i < argc ; i++) {
325 if (!strcmp(argv[i], "-"))
326 break;
327
328 if (argv[i][0] != '-')
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000329 break;
Daniel Veillard344cee72001-08-20 00:08:40 +0000330 if ((!strcmp(argv[i], "-verbose")) ||
331 (!strcmp(argv[i], "-v")) ||
332 (!strcmp(argv[i], "--verbose"))) {
333 verbose++;
334 xmlCatalogSetDebug(verbose);
Daniel Veillardcda96922001-08-21 10:56:31 +0000335 } else if ((!strcmp(argv[i], "-noout")) ||
336 (!strcmp(argv[i], "--noout"))) {
337 noout = 1;
Daniel Veillard344cee72001-08-20 00:08:40 +0000338 } else if ((!strcmp(argv[i], "-shell")) ||
339 (!strcmp(argv[i], "--shell"))) {
340 shell++;
341 noout = 1;
Daniel Veillard82d75332001-10-08 15:01:59 +0000342 } else if ((!strcmp(argv[i], "-sgml")) ||
343 (!strcmp(argv[i], "--sgml"))) {
344 sgml++;
Daniel Veillarde7ead2d2001-08-22 23:44:09 +0000345 } else if ((!strcmp(argv[i], "-create")) ||
346 (!strcmp(argv[i], "--create"))) {
347 create++;
Daniel Veillard6c5f9d12001-08-25 13:33:14 +0000348 } else if ((!strcmp(argv[i], "-convert")) ||
349 (!strcmp(argv[i], "--convert"))) {
350 convert++;
Daniel Veillardcda96922001-08-21 10:56:31 +0000351 } else if ((!strcmp(argv[i], "-add")) ||
352 (!strcmp(argv[i], "--add"))) {
Daniel Veillard82d75332001-10-08 15:01:59 +0000353 if (sgml)
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000354 i += 2;
Daniel Veillard82d75332001-10-08 15:01:59 +0000355 else
356 i += 3;
Daniel Veillardcda96922001-08-21 10:56:31 +0000357 add++;
358 } else if ((!strcmp(argv[i], "-del")) ||
359 (!strcmp(argv[i], "--del"))) {
360 i += 1;
361 del++;
Daniel Veillard344cee72001-08-20 00:08:40 +0000362 } else {
363 fprintf(stderr, "Unknown option %s\n", argv[i]);
364 usage(argv[0]);
365 return(1);
366 }
367 }
368
369 for (i = 1; i < argc; i++) {
Daniel Veillardcda96922001-08-21 10:56:31 +0000370 if ((!strcmp(argv[i], "-add")) ||
371 (!strcmp(argv[i], "--add"))) {
Daniel Veillard82d75332001-10-08 15:01:59 +0000372 if (sgml)
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000373 i += 2;
Daniel Veillard82d75332001-10-08 15:01:59 +0000374 else
375 i += 3;
Daniel Veillard344cee72001-08-20 00:08:40 +0000376 continue;
Daniel Veillardcda96922001-08-21 10:56:31 +0000377 } else if ((!strcmp(argv[i], "-del")) ||
378 (!strcmp(argv[i], "--del"))) {
379 i += 1;
380 continue;
381 } else if (argv[i][0] == '-')
382 continue;
383 filename = argv[i];
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000384 if (!sgml) {
Daniel Veillard82d75332001-10-08 15:01:59 +0000385 ret = xmlLoadCatalog(argv[i]);
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000386 if ((ret < 0) && (create)) {
387 xmlCatalogAdd(BAD_CAST "catalog", BAD_CAST argv[i], NULL);
388 }
Daniel Veillarde7ead2d2001-08-22 23:44:09 +0000389 }
Daniel Veillardcda96922001-08-21 10:56:31 +0000390 break;
391 }
392
Daniel Veillard6c5f9d12001-08-25 13:33:14 +0000393 if (convert)
394 ret = xmlCatalogConvert();
Daniel Veillardcda96922001-08-21 10:56:31 +0000395
Daniel Veillard6c5f9d12001-08-25 13:33:14 +0000396 if ((add) || (del)) {
Daniel Veillardcda96922001-08-21 10:56:31 +0000397 for (i = 1; i < argc ; i++) {
398 if (!strcmp(argv[i], "-"))
399 break;
400
401 if (argv[i][0] != '-')
402 continue;
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000403 if (strcmp(argv[i], "-add") && strcmp(argv[i], "--add") &&
404 strcmp(argv[i], "-del") && strcmp(argv[i], "--del"))
405 continue;
406
407 if (sgml) {
408 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000409 * Maintenance of SGML catalogs.
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000410 */
411 xmlCatalogPtr catal = NULL;
412 xmlCatalogPtr super = NULL;
413
414 catal = xmlLoadSGMLSuperCatalog(argv[i + 1]);
415
416 if ((!strcmp(argv[i], "-add")) ||
417 (!strcmp(argv[i], "--add"))) {
418 if (catal == NULL)
419 catal = xmlNewCatalog(1);
420 super = xmlLoadSGMLSuperCatalog(XML_SGML_DEFAULT_CATALOG);
421 if (super == NULL)
422 super = xmlNewCatalog(1);
423
424 xmlACatalogAdd(catal, BAD_CAST "CATALOG",
425 BAD_CAST argv[i + 2], NULL);
426 xmlACatalogAdd(super, BAD_CAST "CATALOG",
427 BAD_CAST argv[i + 1], NULL);
Daniel Veillard82d75332001-10-08 15:01:59 +0000428 } else {
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000429 if (catal != NULL)
430 ret = xmlACatalogRemove(catal, BAD_CAST argv[i + 2]);
Daniel Veillard82d75332001-10-08 15:01:59 +0000431 else
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000432 ret = -1;
433 if (ret < 0)
434 fprintf(stderr, "Failed to removed entry from %s\n",
435 argv[i + 1]);
436 if ((noout) && (catal != NULL) &&
437 (xmlCatalogIsEmpty(catal))) {
438 super = xmlLoadSGMLSuperCatalog(
439 XML_SGML_DEFAULT_CATALOG);
440 if (super != NULL) {
441 ret = xmlACatalogRemove(super,
442 BAD_CAST argv[i + 1]);
443 if (ret < 0)
444 fprintf(stderr,
445 "Failed to removed entry from %s\n",
446 XML_SGML_DEFAULT_CATALOG);
447 }
448 }
Daniel Veillard82d75332001-10-08 15:01:59 +0000449 }
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000450 if (noout) {
451 FILE *out;
452
453 if (xmlCatalogIsEmpty(catal)) {
Daniel Veillard6eb17722001-11-04 22:19:27 +0000454 remove(argv[i + 1]);
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000455 } else {
456 out = fopen(argv[i + 1], "w");
457 if (out == NULL) {
458 fprintf(stderr, "could not open %s for saving\n",
459 argv[i + 1]);
460 noout = 0;
461 } else {
462 xmlACatalogDump(catal, out);
463 fclose(out);
464 }
465 }
466 if (super != NULL) {
467 if (xmlCatalogIsEmpty(super)) {
Daniel Veillard6eb17722001-11-04 22:19:27 +0000468 remove(XML_SGML_DEFAULT_CATALOG);
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000469 } else {
470 out = fopen(XML_SGML_DEFAULT_CATALOG, "w");
471 if (out == NULL) {
472 fprintf(stderr,
473 "could not open %s for saving\n",
474 XML_SGML_DEFAULT_CATALOG);
475 noout = 0;
476 } else {
477
478 xmlACatalogDump(super, out);
479 fclose(out);
480 }
481 }
482 }
483 } else {
484 xmlACatalogDump(catal, stdout);
485 }
486 i += 2;
487 } else {
488 if ((!strcmp(argv[i], "-add")) ||
489 (!strcmp(argv[i], "--add"))) {
490 if ((argv[i + 3] == NULL) || (argv[i + 3][0] == 0))
491 ret = xmlCatalogAdd(BAD_CAST argv[i + 1], NULL,
492 BAD_CAST argv[i + 2]);
493 else
494 ret = xmlCatalogAdd(BAD_CAST argv[i + 1],
495 BAD_CAST argv[i + 2],
496 BAD_CAST argv[i + 3]);
497 if (ret != 0)
498 printf("add command failed\n");
499 i += 3;
500 } else if ((!strcmp(argv[i], "-del")) ||
501 (!strcmp(argv[i], "--del"))) {
502 ret = xmlCatalogRemove(BAD_CAST argv[i + 1]);
503 i += 1;
504 }
Daniel Veillardcda96922001-08-21 10:56:31 +0000505 }
506 }
507
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000508 } else if (shell) {
Daniel Veillard344cee72001-08-20 00:08:40 +0000509 usershell();
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000510 } else {
511 for (i++; i < argc; i++) {
512 xmlURIPtr uri;
513 xmlChar *ans;
514
515 uri = xmlParseURI(argv[i]);
516 if (uri == NULL) {
517 ans = xmlCatalogResolvePublic((const xmlChar *) argv[i]);
518 if (ans == NULL) {
519 printf("No entry for PUBLIC %s\n", argv[i]);
520 } else {
521 printf("%s\n", ans);
522 xmlFree(ans);
523 }
524 } else {
525 xmlFreeURI(uri);
526 ans = xmlCatalogResolveSystem((const xmlChar *) argv[i]);
527 if (ans == NULL) {
528 printf("No entry for SYSTEM %s\n", argv[i]);
529 } else {
530 printf("%s\n", ans);
531 xmlFree(ans);
532 }
533 }
534 }
Daniel Veillard344cee72001-08-20 00:08:40 +0000535 }
Daniel Veillardcd21dc72001-11-04 20:03:38 +0000536 if ((!sgml) && ((add) || (del) || (create) || (convert))) {
Daniel Veillarde7ead2d2001-08-22 23:44:09 +0000537 if (noout) {
538 FILE *out;
539
540 out = fopen(filename, "w");
541 if (out == NULL) {
542 fprintf(stderr, "could not open %s for saving\n", filename);
543 noout = 0;
544 } else {
545 xmlCatalogDump(out);
546 }
547 } else {
548 xmlCatalogDump(stdout);
549 }
550 }
Daniel Veillard344cee72001-08-20 00:08:40 +0000551
552 /*
553 * Cleanup and check for memory leaks
554 */
Daniel Veillard344cee72001-08-20 00:08:40 +0000555 xmlCleanupParser();
556 xmlMemoryDump();
557 return(0);
558}
559#else
560int main(int argc, char **argv) {
561 fprintf(stderr, "libxml was not compiled with catalog support\n");
562 return(1);
563}
564#endif