tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guenter Knauf <fua...@apache.org>
Subject Re: More on i5/OS and some modifications needed
Date Mon, 23 Apr 2007 16:23:03 GMT
Hi Henri,
suggestion (otherwise we would also have 2 unused vars rc and ptr on all non-AS400 platforms):

int jk_file_exists(const char *f)
{
    if (f) {
        struct stat st;
        int rc;
#ifdef AS400
#define S_IFREG _S_IFREG
        char *ptr;
/**
 * 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);
#else /* AS400_UTF8 */
        rc = stat(f, &st);
#endif /* AS400_UTF8 */
#else /* AS400 */
        rc = stat(f, &st);
#endif /* AS400 */
        if ((0 == rc) && (st.st_mode & S_IFREG))
            return JK_TRUE;
    }

    return JK_FALSE;
}


Guenter.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message