xmllint: Make --shell ignore some other options

When the shell should be launched with the --shell option, don't
post-validate, stream or dump the document. Ignore the --repeat option.
This commit is contained in:
Nick Wellnhofer 2025-01-07 19:01:57 +01:00
parent c0c69cb868
commit 86401cc3d2

View File

@ -2108,13 +2108,6 @@ parseAndPrintFile(const char *filename, xmlParserCtxtPtr pctxt) {
}
#endif
#ifdef LIBXML_XPATH_ENABLED
if (xpathquery != NULL) {
xmlXPathOrderDocElems(doc);
doXPathQuery(doc, xpathquery);
}
#endif
#ifndef XMLLINT_FUZZ
/*
* shell interaction
@ -2124,6 +2117,14 @@ parseAndPrintFile(const char *filename, xmlParserCtxtPtr pctxt) {
xmlXPathOrderDocElems(doc);
#endif
xmllintShell(doc, filename, stdout);
goto done;
}
#endif
#ifdef LIBXML_XPATH_ENABLED
if (xpathquery != NULL) {
xmlXPathOrderDocElems(doc);
doXPathQuery(doc, xpathquery);
}
#endif
@ -2577,6 +2578,7 @@ parseAndPrintFile(const char *filename, xmlParserCtxtPtr pctxt) {
xmlDebugDumpEntities(ERR_STREAM, doc);
#endif
done:
/*
* free it.
*/
@ -2949,7 +2951,6 @@ xmllintMain(int argc, const char **argv, xmlResourceLoader loader) {
if ((!strcmp(argv[i], "-shell")) ||
(!strcmp(argv[i], "--shell"))) {
shell++;
noout = 1;
} else
if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy")))
copy++;
@ -3255,6 +3256,9 @@ xmllintMain(int argc, const char **argv, xmlResourceLoader loader) {
}
}
if (shell)
repeat = 1;
#ifdef LIBXML_CATALOG_ENABLED
if (nocatalogs == 0) {
if (catalogs) {