mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-21 22:50:08 +03:00
Add a flag to not output anything when xmllint succeeded
This commit is contained in:
parent
4defa2c24a
commit
02bee4c414
25
xmllint.c
25
xmllint.c
@ -165,6 +165,7 @@ static int xinclude = 0;
|
||||
static int dtdattrs = 0;
|
||||
static int loaddtd = 0;
|
||||
static xmllintReturnCode progresult = XMLLINT_RETURN_OK;
|
||||
static int quiet = 0;
|
||||
static int timing = 0;
|
||||
static int generate = 0;
|
||||
static int dropdtd = 0;
|
||||
@ -1665,7 +1666,9 @@ testSAX(const char *filename) {
|
||||
(void *)user_data);
|
||||
if (repeat == 0) {
|
||||
if (ret == 0) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
}
|
||||
} else if (ret > 0) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
@ -1948,7 +1951,9 @@ static void streamFile(char *filename) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
} else {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -2840,7 +2845,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
||||
#endif
|
||||
ret = xmlSchematronValidateDoc(ctxt, doc);
|
||||
if (ret == 0) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
}
|
||||
} else if (ret > 0) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
@ -2868,7 +2875,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
||||
xmlRelaxNGSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
|
||||
ret = xmlRelaxNGValidateDoc(ctxt, doc);
|
||||
if (ret == 0) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
}
|
||||
} else if (ret > 0) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
@ -2893,7 +2902,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
||||
xmlSchemaSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
|
||||
ret = xmlSchemaValidateDoc(ctxt, doc);
|
||||
if (ret == 0) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
}
|
||||
} else if (ret > 0) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
@ -3010,6 +3021,7 @@ static void usage(FILE *f, const char *name) {
|
||||
fprintf(f, "\t--dtdvalid URL : do a posteriori validation against a given DTD\n");
|
||||
fprintf(f, "\t--dtdvalidfpi FPI : same but name the DTD with a Public Identifier\n");
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
fprintf(f, "\t--quiet : be quiet when succeeded\n");
|
||||
fprintf(f, "\t--timing : print some timings\n");
|
||||
fprintf(f, "\t--output file or -o file: save to a given file\n");
|
||||
fprintf(f, "\t--repeat : repeat 100 times, for timing or profiling\n");
|
||||
@ -3244,6 +3256,9 @@ main(int argc, char **argv) {
|
||||
else if ((!strcmp(argv[i], "-insert")) ||
|
||||
(!strcmp(argv[i], "--insert")))
|
||||
insert++;
|
||||
else if ((!strcmp(argv[i], "-quiet")) ||
|
||||
(!strcmp(argv[i], "--quiet")))
|
||||
quiet++;
|
||||
else if ((!strcmp(argv[i], "-timing")) ||
|
||||
(!strcmp(argv[i], "--timing")))
|
||||
timing++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user