1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-07 10:42:55 +03:00

return useful code signaling error conditions closing #56649 (RH) Daniel

* xsltproc/xsltproc.c: return useful code signaling error conditions
  closing #56649 (RH)
Daniel
This commit is contained in:
Daniel Veillard
2001-11-26 20:46:26 +00:00
parent 86beea2002
commit 3d62075937
2 changed files with 13 additions and 3 deletions

View File

@@ -101,6 +101,7 @@ static int profile = 0;
static const char *params[16 + 1];
static int nbparams = 0;
static const char *output = NULL;
static int errorno = 0;
/*
* Internal timing routines to remove the necessity to have unix-specific
@@ -277,6 +278,7 @@ xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) {
fprintf(stderr,
"Unsupported non standard output %s\n",
cur->method);
errorno = 7;
}
}
#ifdef LIBXML_DEBUG_ENABLED
@@ -437,7 +439,7 @@ main(int argc, char **argv)
params[nbparams++] = argv[i];
if (nbparams >= 16) {
fprintf(stderr, "too many params\n");
return (1);
return (2);
}
} else if ((!strcmp(argv[i], "-maxdepth")) ||
(!strcmp(argv[i], "--maxdepth"))) {
@@ -451,7 +453,7 @@ main(int argc, char **argv)
} else {
fprintf(stderr, "Unknown option %s\n", argv[i]);
usage(argv[0]);
return (1);
return (3);
}
}
params[nbparams] = NULL;
@@ -491,6 +493,7 @@ main(int argc, char **argv)
if (style == NULL) {
fprintf(stderr, "cannot parse %s\n", argv[i]);
cur = NULL;
errorno = 4;
} else {
cur = xsltLoadStylesheetPI(style);
if (cur != NULL) {
@@ -508,6 +511,7 @@ main(int argc, char **argv)
i++;
} else {
xmlFreeDoc(style);
errorno = 5;
goto done;
}
}
@@ -540,6 +544,7 @@ main(int argc, char **argv)
doc = xmlParseFile(argv[i]);
if (doc == NULL) {
fprintf(stderr, "unable to parse %s\n", argv[i]);
errorno = 6;
continue;
}
if (timing)
@@ -553,6 +558,6 @@ done:
xsltCleanupGlobals();
xmlCleanupParser();
xmlMemoryDump();
return (0);
return(errorno);
}