#include "rfc1867.h"
-#if WIN32||WINNT
+#if PHP_WIN32
#define STRCASECMP stricmp
#else
#define STRCASECMP strcasecmp
#define SAPI_POST_BLOCK_SIZE 4000
-#if WIN32||WINNT
+#if PHP_WIN32
# ifdef SAPI_EXPORTS
# define SAPI_API __declspec(dllexport)
# else
if (!env_location) {
env_location="";
}
-#if WIN32|WINNT
+#if PHP_WIN32
{
if (php_ini_path) {
default_location = php_ini_path;
php_ini_search_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
if (!php_ini_path) {
-#if WIN32|WINNT
+#if PHP_WIN32
sprintf(php_ini_search_path,".;%s;%s",env_location,default_location);
#else
sprintf(php_ini_search_path,".:%s:%s",env_location,default_location);
PG(open_basedir) = open_basedir;
if (!cfgin) {
-# if WIN32|WINNT
+# if PHP_WIN32
return FAILURE;
# else
return SUCCESS; /* having no configuration file is ok */
/* Strip filename */
while ((
-#if WIN32|WINNT
+#if PHP_WIN32
(local_open_basedir[local_open_basedir_pos] != '\\') ||
#endif
(local_open_basedir[local_open_basedir_pos] != '/')
/* Resolve the real path into resolved_name */
if ((php_realpath(path, resolved_name) != NULL) && (php_realpath(local_open_basedir, resolved_basedir) != NULL)) {
/* Check the path */
-#if WIN32|WINNT
+#if PHP_WIN32
if (strncasecmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
#else
if (strncmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
ptr = pathbuf;
while (ptr && *ptr) {
-#if WIN32|WINNT
+#if PHP_WIN32
end = strchr(ptr, ';');
#else
end = strchr(ptr, ':');
return fp;
}
/* Absolute path open - prepend document_root in safe mode */
-#if WIN32|WINNT
+#if PHP_WIN32
if ((*filename == '\\') || (*filename == '/') || (filename[1] == ':')) {
#else
if (*filename == '/') {
ptr = pathbuf;
while (ptr && *ptr) {
-#if WIN32|WINNT
+#if PHP_WIN32
end = strchr(ptr, ';');
#else
end = strchr(ptr, ':');
#define USE_PATH 1
#define IGNORE_URL 2
/* There's no USE_URL. */
-#if WIN32|WINNT
+#if PHP_WIN32
# define IGNORE_URL_WIN 2
#else
# define IGNORE_URL_WIN 0
#endif
#define ENFORCE_SAFE_MODE 4
-#if WIN32|WINNT
+#if PHP_WIN32
# define SOCK_ERR INVALID_SOCKET
# define SOCK_CONN_ERR SOCKET_ERROR
# define SOCK_RECV_ERR SOCKET_ERROR
#include "ext/standard/php_standard.h"
#include "snprintf.h"
#include "php_variables.h"
-#if WIN32|WINNT
+#if PHP_WIN32
#include <io.h>
#include <fcntl.h>
#include "win32/syslog.h"
#include "php.h"
-#if (WINNT|WIN32)
+#if (PHP_WIN32)
#include <winsock.h> /* Includes definition for u_char */
#endif
#include "php_version.h"
#include "zend.h"
+#define PHP_WIN32 ZEND_WIN32
+
/* automake defines PACKAGE and VERSION for Zend too */
#ifdef PACKAGE
# undef PACKAGE
*/
-#if WIN32
+#if PHP_WIN32
#include "config.w32.h"
#include "win95nt.h"
# ifdef PHP_EXPORTS
#define DEBUG ZEND_DEBUG
-#if DEBUG || !(defined(__GNUC__)||defined(WIN32))
+#if DEBUG || !(defined(__GNUC__)||PHP_WIN32
#ifdef inline
#undef inline
#endif
#endif
#if HAVE_PWD_H
-# if WIN32||WINNT
+# if PHP_WIN32
#include "win32/pwd.h"
#include "win32/param.h"
# else
/* global variables */
extern pval *data;
-#if !(WIN32||WINNT)
+#if !(PHP_WIN32)
extern char **environ;
#endif
char path_copy[MAXPATHLEN]; /* A work-copy of the path */
char *workpos; /* working position in *path */
-#if !(WIN32|WINNT)
+#if !(PHP_WIN32)
char buf[MAXPATHLEN]; /* Buffer for readlink */
int linklength; /* The result from readlink */
#endif
struct stat filestat; /* result from stat */
-#if WIN32|WINNT
+#if PHP_WIN32
char *temppos; /* position while counting '.' */
int dotcount; /* number of '.' */
int t; /* counter */
strcpy(path_copy, path);
workpos = path_copy;
-#if WIN32|WINNT
+#if PHP_WIN32
/* Find out where we start - Windows version */
if ((*workpos == '\\') || (*workpos == '/')) {
/* We start at the root of the current drive */
/* Go to the end, then stop */
while(*workpos != 0) {
/* Strip (back)slashes */
-#if WIN32|WINNT
+#if PHP_WIN32
while(*workpos == '\\') workpos++;
#else
while(*workpos == '/') workpos++;
#endif
-#if WIN32|WINNT
+#if PHP_WIN32
/* reset dotcount */
dotcount = 0;
*writepos++ = *workpos++;
}
*writepos = 0;
-#else /* WIN32|WINNT */
+#else /* PHP_WIN32 */
/* Look for .. */
if ((workpos[0] == '.') && (workpos[1] != 0)) {
if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
*writepos++ = *workpos++;
}
*writepos = 0;
-#endif /* WIN32|WINNT */
+#endif /* PHP_WIN32 */
}
/* Check if the resolved path is a directory */
if (!request_info.script_filename) {
request_info.script_filename = request_info.php_argv0;
}
-#if WIN32|WINNT
+#if PHP_WIN32
/* FIXME WHEN APACHE NT IS FIXED */
/* a hack for apache nt because it does not appear to set argv[1] and sets
script filename to php.exe thus makes us parse php.exe instead of file.php