You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by hg...@apache.org on 2007/04/24 10:00:07 UTC
svn commit: r531815 - in /tomcat/connectors/trunk/jk/native/common:
jk_util.c jk_util.h
Author: hgomez
Date: Tue Apr 24 01:00:07 2007
New Revision: 531815
URL: http://svn.apache.org/viewvc?view=rev&rev=531815
Log:
define jk_stat(). On i5/OS the jk_stat will do the ASCII->EBCDIC conversion and next call stat().
On others platform jk_stat is just stat
Modified:
tomcat/connectors/trunk/jk/native/common/jk_util.c
tomcat/connectors/trunk/jk/native/common/jk_util.h
Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?view=diff&rev=531815&r1=531814&r2=531815
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Tue Apr 24 01:00:07 2007
@@ -525,7 +525,15 @@
used = usable_size;
}
buf[used] = 0;
+
+/*
+ * MCH errors encountered on i5/OS (V5R3/V5R4) when using jk_logger, use the JOBLOB QPRINT instead for now
+ */
+#ifdef AS400
+ printf("%s\n", buf);
+#else
l->log(l, level, buf);
+#endif
#ifdef NETWARE
free(buf);
#endif
@@ -1390,43 +1398,33 @@
}
-int jk_file_exists(const char *f)
-{
- int rc;
- char *ptr;
-
- if (f) {
- struct stat st;
-
-#ifdef AS400
-
/**
* i5/OS V5R4 expect filename in ASCII for fopen but required them in EBCDIC for stat()
*/
#ifdef AS400_UTF8
- ptr = (char *)malloc(strlen(f) + 1);
- jk_ascii2ebcdic((char *)f, ptr);
- rc = stat(ptr, &st);
- free(ptr);
-
- if ((0 == rc) && (st.st_mode & _S_IFREG))
- return JK_TRUE;
+int jk_stat(const char *f, struct stat * statbuf)
+{
+ char *ptr;
+ int rc;
-#else /* AS400_UTF8 */
+ ptr = (char *)malloc(strlen(f) + 1);
+ jk_ascii2ebcdic((char *)f, ptr);
+ rc = stat(ptr, statbuf);
+ free(ptr);
- if ((0 == stat(f, &st)) && (st.st_mode & _S_IFREG))
- return JK_TRUE;
+ return (rc);
+}
-#endif /* AS400_UTF8 */
+#endif
-#else /* AS400 */
+int jk_file_exists(const char *f)
+{
+ if (f) {
+ struct stat st;
- if ((0 == stat(f, &st)) && (st.st_mode & S_IFREG))
+ if ((0 == jk_stat(f, &st)) && (st.st_mode & S_IFREG))
return JK_TRUE;
-
-#endif /* AS400 */
-
}
return JK_FALSE;
@@ -1582,7 +1580,7 @@
char **jk_parse_sysprops(jk_pool_t *p, const char *sysprops)
{
char **rc = NULL;
-#if defined(AS400) || defined(_REENTRANT)
+#ifdef _REENTRANT
char *lasts;
#endif
@@ -1600,7 +1598,7 @@
rc = jk_pool_alloc(p, (num_of_prps + 1) * sizeof(char *));
if (rc) {
unsigned i = 0;
-#if defined(AS400) || defined(_REENTRANT)
+#ifdef _REENTRANT
char *tmp = strtok_r(prps, "*", &lasts);
#else
char *tmp = strtok(prps, "*");
@@ -1608,7 +1606,7 @@
while (tmp && i < num_of_prps) {
rc[i] = tmp;
-#if defined(AS400) || defined(_REENTRANT)
+#ifdef _REENTRANT
tmp = strtok_r(NULL, "*", &lasts);
#else
tmp = strtok(NULL, "*");
Modified: tomcat/connectors/trunk/jk/native/common/jk_util.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.h?view=diff&rev=531815&r1=531814&r2=531815
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.h Tue Apr 24 01:00:07 2007
@@ -211,10 +211,26 @@
#define TC41_BRIDGE_TYPE 41
#define TC50_BRIDGE_TYPE 50
+#ifdef AS400
+
+#define S_IFREG _S_IFREG
+
#ifdef AS400_UTF8
+
void jk_ascii2ebcdic(char *src, char *dst);
void jk_ebcdic2ascii(char *src, char *dst);
+
+/* i5/OS V5R4 need ASCII-EBCDIC conversion before stat() call */
+int jk_stat(const char *f, struct stat * statbuf);
+
+#else /* AS400_UTF8 */
+
+#define jk_stat(a, b) stat(a, b)
+
+#endif /* AS400_UTF8 */
+
#endif
+
#ifdef __cplusplus
extern "C"
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org