]> granicus.if.org Git - php/commitdiff
We should define symlink functions only when HAVE_SYMLINK is defined.
authorAndrei Zmievski <andrei@php.net>
Tue, 13 Jun 2000 18:07:19 +0000 (18:07 +0000)
committerAndrei Zmievski <andrei@php.net>
Tue, 13 Jun 2000 18:07:19 +0000 (18:07 +0000)
Otherwise, they should be aliased as not available.

ext/standard/basic_functions.c
ext/standard/link.c
ext/standard/php_link.h

index bcbf92287c8b3eea4eaf05d28a79b6114a87cce6..4e109a32b7d5b5bc30f97b2b64997bc279e0495f 100644 (file)
@@ -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)
index 7cb9102b94581dcab16621ac1e6183324a37ae9a..dbec5e087b3de71eeebf0ed960fa1bde68450291 100644 (file)
@@ -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:
index e3c1116f257cb6841057077cf84b22f63873cd85..8d6e113ac57196d6e912ea13fbab59b11a360c0f 100644 (file)
 #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 */