From b9037f7d691bf1a88d6aaf708d3babb28836c468 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Sun, 2 Jul 2000 15:12:34 +0000 Subject: [PATCH] - Make PHP compile again under Windows. - Please be careful when you make such changes. --- ext/odbc/php_odbc.c | 2 +- ext/standard/basic_functions.c | 1 - ext/standard/file.c | 36 +++++++++++++++++++++++++++++++--- ext/standard/file.h | 1 + ext/standard/link.c | 28 -------------------------- ext/standard/php_link.h | 1 - 6 files changed, 35 insertions(+), 34 deletions(-) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 4cde4067721..5ea0a584ac8 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1227,7 +1227,7 @@ PHP_FUNCTION(odbc_fetch_into) } /* }}} */ -#ifdef HAVE_SOLID || defined(HAVE_SOLID_35) +#if defined(HAVE_SOLID) || defined(HAVE_SOLID_35) PHP_FUNCTION(solid_fetch_prev) { odbc_result *result; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index cde33a8bd60..1cda0abfe6e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -53,7 +53,6 @@ #include "php_globals.h" #include "SAPI.h" - #ifdef ZTS int basic_globals_id; #else diff --git a/ext/standard/file.c b/ext/standard/file.c index 99ae1969041..e03e9db77d2 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -27,6 +27,7 @@ #include "php_globals.h" #include "ext/standard/flock_compat.h" #include "ext/standard/exec.h" +#include "ext/standard/php_filestat.h" #include #include @@ -1575,11 +1576,10 @@ PHP_FUNCTION(fpassthru) zend_list_delete((*arg1)->value.lval); RETURN_LONG(size); } - /* }}} */ + /* {{{ proto int rename(string old_name, string new_name) Rename a file */ - PHP_FUNCTION(rename) { pval **old_arg, **new_arg; @@ -1609,8 +1609,38 @@ PHP_FUNCTION(rename) RETVAL_TRUE; } - /* }}} */ + + +/* {{{ proto int unlink(string filename) + Delete a file */ +PHP_FUNCTION(unlink) +{ + pval **filename; + int ret; + PLS_FETCH(); + + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_string_ex(filename); + + if (PG(safe_mode) && !php_checkuid((*filename)->value.str.val, NULL, 2)) { + RETURN_FALSE; + } + + ret = V_UNLINK((*filename)->value.str.val); + if (ret == -1) { + php_error(E_WARNING, "Unlink failed (%s)", strerror(errno)); + RETURN_FALSE; + } + /* Clear stat cache */ + PHP_FN(clearstatcache)(INTERNAL_FUNCTION_PARAM_PASSTHRU); + RETURN_TRUE; +} +/* }}} */ + + /* {{{ proto int ftruncate (int fp, int size) Truncate file to 'size' length */ PHP_FUNCTION(ftruncate) diff --git a/ext/standard/file.h b/ext/standard/file.h index adf9d9b028f..17757e8fc25 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -60,6 +60,7 @@ PHP_FUNCTION(fpassthru); PHP_FUNCTION(readfile); PHP_FUNCTION(umask); PHP_FUNCTION(rename); +PHP_FUNCTION(unlink); PHP_FUNCTION(copy); PHP_FUNCTION(file); PHP_FUNCTION(set_socket_blocking); /* deprecated */ diff --git a/ext/standard/link.c b/ext/standard/link.c index 18cd67c1dc7..f7dd9a1aeb9 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -158,37 +158,9 @@ PHP_FUNCTION(link) } /* }}} */ -/* {{{ proto int unlink(string filename) - Delete a file */ -PHP_FUNCTION(unlink) -{ - pval **filename; - int ret; - PLS_FETCH(); - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(filename); - - if (PG(safe_mode) && !php_checkuid((*filename)->value.str.val, NULL, 2)) { - RETURN_FALSE; - } - - ret = V_UNLINK((*filename)->value.str.val); - if (ret == -1) { - php_error(E_WARNING, "Unlink failed (%s)", strerror(errno)); - RETURN_FALSE; - } - /* Clear stat cache */ - PHP_FN(clearstatcache)(INTERNAL_FUNCTION_PARAM_PASSTHRU); - RETURN_TRUE; -} -/* }}} */ #endif - /* * Local variables: * tab-width: 4 diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h index 8d6e113ac57..f8189e850ff 100644 --- a/ext/standard/php_link.h +++ b/ext/standard/php_link.h @@ -35,7 +35,6 @@ #ifdef HAVE_SYMLINK PHP_FUNCTION(link); -PHP_FUNCTION(unlink); PHP_FUNCTION(readlink); PHP_FUNCTION(linkinfo); PHP_FUNCTION(symlink);