cvs: php4 /ext/session mod_files.c /main fopen-wrappers.c php.h

From: Date: Sun, 20 Aug 2000 14:02:57 +0000
Subject: cvs: php4 /ext/session mod_files.c /main fopen-wrappers.c php.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1258@lists.php.net to get a copy of this message
sas Sun Aug 20 07:02:57 2000 EDT Modified files: /php4/ext/session mod_files.c /php4/main fopen-wrappers.c php.h Log: Provide PHP_SEPARATOR which expands to the default directory separator on the target platform. Index: php4/ext/session/mod_files.c diff -u php4/ext/session/mod_files.c:1.40 php4/ext/session/mod_files.c:1.41 --- php4/ext/session/mod_files.c:1.40 Sat Aug 5 03:25:00 2000 +++ php4/ext/session/mod_files.c Sun Aug 20 07:02:57 2000 @@ -55,12 +55,6 @@ PS_MOD(files) }; -#ifdef PHP_WIN32 -#define DIR_DELIMITER '\\' -#else -#define DIR_DELIMITER '/' -#endif - static int _ps_files_valid_key(const char *key) { size_t len; @@ -98,10 +92,10 @@ (strlen(data->basedir) + 2 * data->dirdepth + keylen + 5 + sizeof(FILE_PREFIX))) return NULL; p = key; - n = sprintf(buf, "%s%c", data->basedir, DIR_DELIMITER); + n = sprintf(buf, "%s%c", data->basedir, PHP_SEPARATOR); for (i = 0; i < data->dirdepth; i++) { buf[n++] = *p++; - buf[n++] = DIR_DELIMITER; + buf[n++] = PHP_SEPARATOR; } buf[n] = '\0'; strcat(buf, FILE_PREFIX); @@ -175,7 +169,7 @@ /* does the file start with our prefix? */ if (!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1) && /* create full path */ - snprintf(buf, MAXPATHLEN, "%s%c%s", dirname, DIR_DELIMITER, + snprintf(buf, MAXPATHLEN, "%s%c%s", dirname, PHP_SEPARATOR, entry->d_name) > 0 && /* stat the directory entry */ V_STAT(buf, &sbuf) == 0 && Index: php4/main/fopen-wrappers.c diff -u php4/main/fopen-wrappers.c:1.78 php4/main/fopen-wrappers.c:1.79 --- php4/main/fopen-wrappers.c:1.78 Sat Aug 19 22:27:59 2000 +++ php4/main/fopen-wrappers.c Sun Aug 20 07:02:57 2000 @@ -16,7 +16,7 @@ | Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: fopen-wrappers.c,v 1.78 2000/08/20 05:27:59 sas Exp $ */ +/* $Id: fopen-wrappers.c,v 1.79 2000/08/20 14:02:57 sas Exp $ */ #include "php.h" #include "php_globals.h" @@ -80,10 +80,8 @@ * a joint header file when we move virtual_cwd to TSRM */ #ifdef ZEND_WIN32 #define IS_SLASH(c) ((c) == '/' || (c) == '\\') -#define DEFAULT_SLASH '\\' #else #define IS_SLASH(c) ((c) == '/') -#define DEFAULT_SLASH '/' #endif @@ -319,8 +317,8 @@ if (pw && pw->pw_dir) { filename = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4); if (filename) { - sprintf(filename, "%s%c%s%c%s", pw->pw_dir, DEFAULT_SLASH, - PG(user_dir), DEFAULT_SLASH, s+1); /* Safe */ + sprintf(filename, "%s%c%s%c%s", pw->pw_dir, PHP_SEPARATOR, + PG(user_dir), PHP_SEPARATOR, s+1); /* Safe */ STR_FREE(SG(request_info).path_translated); SG(request_info).path_translated = filename; } @@ -340,7 +338,7 @@ if (filename) { memcpy(filename, PG(doc_root), length); if (!IS_SLASH(filename[length - 1])) { /* length is never 0 */ - filename[length++] = DEFAULT_SLASH; + filename[length++] = PHP_SEPARATOR; } if (IS_SLASH(path_info[0])) { length--; Index: php4/main/php.h diff -u php4/main/php.h:1.112 php4/main/php.h:1.113 --- php4/main/php.h:1.112 Sun Aug 20 05:49:56 2000 +++ php4/main/php.h Sun Aug 20 07:02:57 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.112 2000/08/20 12:49:56 sas Exp $ */ +/* $Id: php.h,v 1.113 2000/08/20 14:02:57 sas Exp $ */ #ifndef PHP_H #define PHP_H @@ -65,9 +65,11 @@ # else # define PHPAPI __declspec(dllimport) # endif +#define PHP_SEPARATOR '\\' #else #define PHPAPI #define THREAD_LS +#define PHP_SEPARATOR '/' #endif #include "php_regex.h"

« previous php.cvs (#1258) next »