summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2000-06-13 18:07:19 +0000
committerAndrei Zmievski <andrei@php.net>2000-06-13 18:07:19 +0000
commite5360259a4835817008f5181a92897d0ef103be3 (patch)
treee46fd1a06bbc280b02bdf22f7f708bbffa796f78 /ext
parent111d36a3c8e9b789a927821b81d95e2d22cd7bc5 (diff)
downloadphp-git-e5360259a4835817008f5181a92897d0ef103be3.tar.gz
We should define symlink functions only when HAVE_SYMLINK is defined.
Otherwise, they should be aliased as not available.
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/basic_functions.c8
-rw-r--r--ext/standard/link.c12
-rw-r--r--ext/standard/php_link.h4
3 files changed, 16 insertions, 8 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index bcbf92287c..4e109a32b7 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -182,11 +182,19 @@ function_entry basic_functions[] = {
PHP_FE(rawurlencode, NULL)
PHP_FE(rawurldecode, NULL)
+#ifdef HAVE_SYMLINK
PHP_FE(readlink, NULL)
PHP_FE(linkinfo, NULL)
PHP_FE(symlink, NULL)
PHP_FE(link, NULL)
PHP_FE(unlink, NULL)
+#else
+ PHP_FALIAS(readlink, warn_not_available, NULL)
+ PHP_FALIAS(linkinfo, warn_not_available, NULL)
+ PHP_FALIAS(symlink, warn_not_available, NULL)
+ PHP_FALIAS(link, warn_not_available, NULL)
+ PHP_FALIAS(unlink, warn_not_available, NULL)
+#endif
PHP_FE(exec, second_and_third_args_force_ref)
PHP_FE(system, second_arg_force_ref)
diff --git a/ext/standard/link.c b/ext/standard/link.c
index 7cb9102b94..dbec5e087b 100644
--- a/ext/standard/link.c
+++ b/ext/standard/link.c
@@ -22,6 +22,8 @@
#include "php_filestat.h"
#include "php_globals.h"
+#ifdef HAVE_SYMLINK
+
#include <stdlib.h>
#if HAVE_UNISTD_H
#include <unistd.h>
@@ -52,7 +54,6 @@
Return the target of a symbolic link */
PHP_FUNCTION(readlink)
{
-#if HAVE_SYMLINK
pval **filename;
char buff[256];
int ret;
@@ -70,7 +71,6 @@ PHP_FUNCTION(readlink)
/* Append NULL to the end of the string */
buff[ret] = '\0';
RETURN_STRING(buff,1);
-#endif
}
/* }}} */
@@ -78,7 +78,6 @@ PHP_FUNCTION(readlink)
Returns the st_dev field of the UNIX C stat structure describing the link */
PHP_FUNCTION(linkinfo)
{
-#if HAVE_SYMLINK
pval **filename;
struct stat sb;
int ret;
@@ -94,7 +93,6 @@ PHP_FUNCTION(linkinfo)
RETURN_LONG(-1L);
}
RETURN_LONG((long) sb.st_dev);
-#endif
}
/* }}} */
@@ -102,7 +100,6 @@ PHP_FUNCTION(linkinfo)
Create a symbolic link */
PHP_FUNCTION(symlink)
{
-#if HAVE_SYMLINK
pval **topath, **frompath;
int ret;
PLS_FETCH();
@@ -127,7 +124,6 @@ PHP_FUNCTION(symlink)
RETURN_FALSE;
}
RETURN_TRUE;
-#endif
}
/* }}} */
@@ -135,7 +131,6 @@ PHP_FUNCTION(symlink)
Create a hard link */
PHP_FUNCTION(link)
{
-#if HAVE_LINK
pval **topath, **frompath;
int ret;
PLS_FETCH();
@@ -160,7 +155,6 @@ PHP_FUNCTION(link)
RETURN_FALSE;
}
RETURN_TRUE;
-#endif
}
/* }}} */
@@ -192,6 +186,8 @@ PHP_FUNCTION(unlink)
}
/* }}} */
+#endif
+
/*
* Local variables:
diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h
index e3c1116f25..8d6e113ac5 100644
--- a/ext/standard/php_link.h
+++ b/ext/standard/php_link.h
@@ -32,10 +32,14 @@
#ifndef _PHP_LINK_H
#define _PHP_LINK_H
+#ifdef HAVE_SYMLINK
+
PHP_FUNCTION(link);
PHP_FUNCTION(unlink);
PHP_FUNCTION(readlink);
PHP_FUNCTION(linkinfo);
PHP_FUNCTION(symlink);
+#endif
+
#endif /* _PHP_LINK_H */