1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-08 21:42:07 +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

@@ -1,3 +1,8 @@
Mon Nov 26 21:45:07 CET 2001 Daniel Veillard <daniel@veillard.com>
* xsltproc/xsltproc.c: return useful code signaling error conditions
closing #56649 (RH)
Mon Nov 26 13:14:14 CET 2001 Daniel Veillard <daniel@veillard.com> Mon Nov 26 13:14:14 CET 2001 Daniel Veillard <daniel@veillard.com>
* configure.in libxslt/xsltwin32config.h: preparing release of 1.0.8 * configure.in libxslt/xsltwin32config.h: preparing release of 1.0.8

View File

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