cvs: php4 /ext/standard/ basic_functions.c link.c php_link.h
| From: | Andrei Zmievski | Date: | Tue, 13 Jun 2000 18:07:19 +0000 |
| Subject: | cvs: php4 /ext/standard/ basic_functions.c link.c php_link.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-237@lists.php.net to get a copy of this message | ||
andrei Tue Jun 13 11:07:19 2000 EDT
Modified files:
/php4/ext/standard basic_functions.c link.c php_link.h
Log:
We should define symlink functions only when HAVE_SYMLINK is defined.
Otherwise, they should be aliased as not available.
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.214 php4/ext/standard/basic_functions.c:1.215
--- php4/ext/standard/basic_functions.c:1.214 Tue Jun 13 09:31:57 2000
+++ php4/ext/standard/basic_functions.c Tue Jun 13 11:07:19 2000
@@ -182,11 +182,19 @@
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: php4/ext/standard/link.c
diff -u php4/ext/standard/link.c:1.23 php4/ext/standard/link.c:1.24
--- php4/ext/standard/link.c:1.23 Mon Jun 5 12:47:44 2000
+++ php4/ext/standard/link.c Tue Jun 13 11:07:19 2000
@@ -16,12 +16,14 @@
+----------------------------------------------------------------------+
*/
-/* $Id: link.c,v 1.23 2000/06/05 19:47:44 andi Exp $ */
+/* $Id: link.c,v 1.24 2000/06/13 18:07:19 andrei Exp $ */
#include "php.h"
#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 @@
/* Append NULL to the end of the string */
buff[ret] = '\0';
RETURN_STRING(buff,1);
-#endif
}
/* }}} */
@@ -78,7 +78,6 @@
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 @@
RETURN_LONG(-1L);
}
RETURN_LONG((long) sb.st_dev);
-#endif
}
/* }}} */
@@ -102,7 +100,6 @@
Create a symbolic link */
PHP_FUNCTION(symlink)
{
-#if HAVE_SYMLINK
pval **topath, **frompath;
int ret;
PLS_FETCH();
@@ -127,7 +124,6 @@
RETURN_FALSE;
}
RETURN_TRUE;
-#endif
}
/* }}} */
@@ -135,7 +131,6 @@
Create a hard link */
PHP_FUNCTION(link)
{
-#if HAVE_LINK
pval **topath, **frompath;
int ret;
PLS_FETCH();
@@ -160,7 +155,6 @@
RETURN_FALSE;
}
RETURN_TRUE;
-#endif
}
/* }}} */
@@ -191,6 +185,8 @@
RETURN_TRUE;
}
/* }}} */
+
+#endif
/*
Index: php4/ext/standard/php_link.h
diff -u php4/ext/standard/php_link.h:1.1 php4/ext/standard/php_link.h:1.2
--- php4/ext/standard/php_link.h:1.1 Sat Dec 4 11:16:04 1999
+++ php4/ext/standard/php_link.h Tue Jun 13 11:07:19 2000
@@ -28,14 +28,18 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_link.h,v 1.1 1999/12/04 19:16:04 sas Exp $ */
+/* $Id: php_link.h,v 1.2 2000/06/13 18:07:19 andrei Exp $ */
#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 */