cvs: /php4 php_virtual_cwd.c

From: Date: Thu, 16 Mar 2000 18:52:46 +0000
Subject: cvs: /php4 php_virtual_cwd.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-12268@lists.php.net to get a copy of this message
andi Thu Mar 16 10:52:46 2000 EDT Modified files: /php4 php_virtual_cwd.c Log: - Make it compile on Windows. Index: php4/php_virtual_cwd.c diff -u php4/php_virtual_cwd.c:1.4 php4/php_virtual_cwd.c:1.5 --- php4/php_virtual_cwd.c:1.4 Thu Mar 16 10:41:02 2000 +++ php4/php_virtual_cwd.c Thu Mar 16 10:52:15 2000 @@ -2,7 +2,11 @@ #include <sys/stat.h> #include <string.h> #include <stdio.h> + +#ifndef PHP_WIN32 #include <unistd.h> +#endif + #include <limits.h> #include <errno.h> #include <stdlib.h> @@ -10,7 +14,7 @@ typedef unsigned int uint; -#if WINDOWS +#ifdef PHP_WIN32 #define IS_SLASH(c) ((c) == '/' || (c) == '\\') #define DEFAULT_SLASH '\\' #define TOKENIZER_STRING "/\\" @@ -31,6 +35,7 @@ #define IS_DIRECTORY_CURRENT(element, len) \ (len == 1 && ptr[0] == '.') +#define strtok_r(a, b, c) strtok((a), (b)) /* Temporary fix for Windows */ #else #define IS_SLASH(c) ((c) == '/') @@ -68,6 +73,7 @@ uint cwd_length; } cwd_state; +#ifndef PHP_WIN32 static int php_is_dir_ok(const cwd_state *state) { struct stat buf; @@ -77,6 +83,7 @@ return (1); } +#endif char *virtual_getcwd(cwd_state *state, uint *length) @@ -91,7 +98,7 @@ return retval; } -#if WINDOWS +#ifdef PHP_WIN32 /* If we have something like C: */ if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') { char *retval; @@ -128,7 +135,7 @@ state->cwd = (char *) malloc(1); state->cwd[0] = '\0'; state->cwd_length = 0; -#if WINDOWS +#ifdef PHP_WIN32 } else if(IS_SLASH(path[0])) { state->cwd = (char *) malloc(3); memcpy(state->cwd, old_state->cwd, 2); @@ -192,7 +199,7 @@ cwd_state state; uint length; -#if !WINDOWS +#ifndef PHP_WIN32 state.cwd = malloc(PATH_MAX + 1); state.cwd_length = PATH_MAX;

« previous php.version4 (#12268) next »