cvs: /php4/ext/standard file.c file.h /php4 TODO
| From: | Andrei Zmievski | Date: | Tue, 01 Feb 2000 06:06:33 +0000 |
| Subject: | cvs: /php4/ext/standard file.c file.h /php4 TODO | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-9613@lists.php.net to get a copy of this message | ||
andrei Tue Feb 1 07:06:33 2000 EDT
Modified files:
/php4/ext/standard file.c file.h
/php4 TODO
Log:
Implemented realpath().
@ Added realpath() function. (Andrei)
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.58 php4/ext/standard/file.c:1.59
--- php4/ext/standard/file.c:1.58 Sat Jan 15 20:42:40 2000
+++ php4/ext/standard/file.c Tue Feb 1 07:06:03 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.58 2000/01/15 19:42:40 andrei Exp $ */
+/* $Id: file.c,v 1.59 2000/02/01 06:06:03 andrei Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -86,6 +86,8 @@
#define MAP_FAILED ((void *) -1)
#endif
+#include "php_realpath.h"
+
/* }}} */
/* {{{ ZTS-stuff / Globals / Prototypes */
@@ -243,6 +245,7 @@
#if HAVE_SYS_TIME_H
PHP_FE(set_socket_timeout, NULL)
#endif
+ PHP_FE(realpath, NULL)
#if 0 /* needs to be rethought 991221 thies@digicol.de */
PHP_FE(fd_set, NULL)
PHP_FE(fd_isset, NULL)
@@ -1685,6 +1688,26 @@
efree(buf);
}
+/* }}} */
+
+/* {{{ proto string realpath(string path)
+ Returns the resolved path */
+PHP_FUNCTION(realpath)
+{
+ zval **path;
+ char resolved_path[MAXPATHLEN];
+
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &path) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string_ex(path);
+ if (php_realpath((*path)->value.str.val, resolved_path)) {
+ RETURN_STRING(resolved_path, 1);
+ } else {
+ RETURN_FALSE;
+ }
+}
/* }}} */
#if 0
Index: php4/ext/standard/file.h
diff -u php4/ext/standard/file.h:1.15 php4/ext/standard/file.h:1.16
--- php4/ext/standard/file.h:1.15 Sat Dec 18 05:01:14 1999
+++ php4/ext/standard/file.h Tue Feb 1 07:06:03 2000
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.h,v 1.15 1999/12/18 04:01:14 zeev Exp $ */
+/* $Id: file.h,v 1.16 2000/02/01 06:06:03 andrei Exp $ */
/* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
@@ -71,6 +71,7 @@
PHP_FUNCTION(fd_set);
PHP_FUNCTION(fd_isset);
PHP_FUNCTION(select);
+PHP_FUNCTION(realpath);
PHPAPI int php_set_sock_blocking(int socketd, int block);
PHPAPI int php_file_le_fopen(void);
Index: php4/TODO
diff -u php4/TODO:1.37 php4/TODO:1.38
--- php4/TODO:1.37 Mon Jan 31 23:10:04 2000
+++ php4/TODO Tue Feb 1 07:06:03 2000
@@ -49,7 +49,6 @@
------------
* strpad() (Andrei)
* stri_replace() (Andrei)
- * realpath() (Andrei)
* socket_get_status (Andrei)
* comparing arrays semantically (like Python) (Andrei)
* NOT binary safe: