------------
* strpad() (Andrei)
* stri_replace() (Andrei)
- * realpath() (Andrei)
* socket_get_status (Andrei)
* comparing arrays semantically (like Python) (Andrei)
* NOT binary safe:
#define MAP_FAILED ((void *) -1)
#endif
+#include "php_realpath.h"
+
/* }}} */
/* {{{ ZTS-stuff / Globals / Prototypes */
#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)
/* }}} */
+/* {{{ 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
static fd_set readfd;