diff options
Diffstat (limited to 'main/php_virtual_cwd.c')
-rw-r--r-- | main/php_virtual_cwd.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main/php_virtual_cwd.c b/main/php_virtual_cwd.c index 4d09ce6750..5b2838385c 100644 --- a/main/php_virtual_cwd.c +++ b/main/php_virtual_cwd.c @@ -745,6 +745,26 @@ CWD_API FILE *virtual_popen(const char *command, const char *type) #endif +/* taken from Apache 1.3 */ + +CWD_API void virtual_real_chdir_file(const char *file) +{ + const char *x; + char buf[4096]; + + x = strrchr(file, '/'); + if (x == NULL) { + chdir(file); + } + else if (x - file < sizeof(buf) - 1) { + memcpy(buf, file, x - file); + buf[x - file] = '\0'; + chdir(buf); + } + /* XXX: well, this is a silly function, no method of reporting an + * error... ah well. */ +} + #if 0 main(void) |