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

complete test of a DocBook XSLt transform with --nonet, need stat(), added

* config.h.in configure.in xsltproc/xsltproc.c: complete test
  of a DocBook XSLt transform with --nonet, need stat(), added
  checking in configure.
Daniel
This commit is contained in:
Daniel Veillard
2001-08-23 21:20:28 +00:00
parent dc8d280599
commit 0da1279f4c
4 changed files with 47 additions and 14 deletions

View File

@@ -1,3 +1,9 @@
Thu Aug 23 23:18:44 CEST 2001 Daniel Veillard <daniel@veillard.com>
* config.h.in configure.in xsltproc/xsltproc.c: complete test
of a DocBook XSLt transform with --nonet, need stat(), added
checking in configure.
Thu Aug 23 17:37:40 CEST 2001 Daniel Veillard <daniel@veillard.com>
* xsltproc/xsltproc.c: catalog integration, cleanup with

View File

@@ -12,6 +12,9 @@
#undef HAVE_FLOOR
#undef HAVE_FABS
/* Define if you have the _stat function. */
#undef HAVE__STAT
/* Define if you have the asctime function. */
#undef HAVE_ASCTIME
@@ -24,6 +27,9 @@
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
/* Define if you have the stat function. */
#undef HAVE_STAT
/* Define if you have the <ansidecl.h> header file. */
#undef HAVE_ANSIDECL_H
@@ -48,6 +54,9 @@
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H

View File

@@ -77,7 +77,8 @@ dnl
AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(time.h sys/stat.h)
AC_CHECK_FUNCS(stat _stat)
AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
[M_LIBS="-lm"; AC_DEFINE(HAVE_ISNAN)]))

View File

@@ -90,6 +90,34 @@ static const char *params[16 + 1];
static int nbparams = 0;
static const char *output = NULL;
#ifdef LIBXML_CATALOG_ENABLED
static int xsltNoNetExists(const char *URL) {
#ifdef HAVE_STAT
int ret;
struct stat info;
const char *path;
if (URL == NULL)
return(0);
if (!xmlStrncmp(BAD_CAST URL, BAD_CAST "file://localhost", 16))
path = &URL[16];
else if (!xmlStrncmp(BAD_CAST URL, BAD_CAST "file:///", 8)) {
#ifdef _WIN32
path = &URL[8];
#else
path = &URL[7];
#endif
} else
path = URL;
ret = stat(path, &info);
if (ret == 0)
return(1);
#endif
return(0);
}
#endif
static xmlParserInputPtr
xsltNoNetExternalEntityLoader(const char *URL, const char *ID,
xmlParserCtxtPtr ctxt) {
@@ -97,9 +125,6 @@ xsltNoNetExternalEntityLoader(const char *URL, const char *ID,
xmlChar *resource = NULL;
#ifdef LIBXML_CATALOG_ENABLED
#ifdef HAVE_STAT
struct stat info;
#endif
xmlCatalogAllow pref;
/*
@@ -108,11 +133,7 @@ xsltNoNetExternalEntityLoader(const char *URL, const char *ID,
*/
pref = xmlCatalogGetDefaults();
if ((pref != XML_CATA_ALLOW_NONE)
#ifdef HAVE_STAT
&& ((URL == NULL) || (stat(URL, &info) < 0))
#endif
) {
if ((pref != XML_CATA_ALLOW_NONE) && (!xsltNoNetExists(URL))) {
/*
* Do a local lookup
*/
@@ -138,11 +159,7 @@ xsltNoNetExternalEntityLoader(const char *URL, const char *ID,
/*
* TODO: do an URI lookup on the reference
*/
if ((resource != NULL)
#ifdef HAVE_STAT
&& (stat((const char *) resource, &info) < 0)
#endif
) {
if ((resource != NULL) && (!xsltNoNetExists((const char *)resource))) {
xmlChar *tmp = NULL;
if ((ctxt->catalogs != NULL) &&