cvs: php4 / php.h /ext/standard/ basic_functions.c crypt.c datetime.c dl.h dns.c file.c microtime.c php_crypt.h
[email protected] ("Hartmut Holzgraefe")
| Newsgroups | php.version4 |
|---|---|
| Message-ID | <cvshholzgra959360642@cvsserver> |
hholzgra Fri May 26 10:04:02 2000 EDT
Modified files:
/php4 php.h
/php4/ext/standard basic_functions.c crypt.c datetime.c dl.h dns.c
file.c microtime.c php_crypt.h
Log:
if a module provides a function it should also do so if the function
is not functional due to configure findings
the function should offer a meaningful warning if it is not supported
instead of just beeing undefined
i had already changed this in 'gd', now this is doing it for 'standard'
Index: php4/php.h
diff -u php4/php.h:1.95 php4/php.h:1.96
--- php4/php.h:1.95 Tue May 23 10:02:21 2000
+++ php4/php.h Fri May 26 10:04:01 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php.h,v 1.95 2000/05/23 17:02:21 andi Exp $ */
+/* $Id: php.h,v 1.96 2000/05/26 17:04:01 hholzgra Exp $ */
#ifndef _PHP_H
#define _PHP_H
@@ -365,6 +365,12 @@
#else
#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
#endif
+
+
+#define PHP_NOT_IN_THIS_BUILD { \
+ php_error(E_WARNING, "%s: not supported in this PHP build",get_active_function_name()); \
+ RETURN_FALSE; \
+}
#endif
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.194 php4/ext/standard/basic_functions.c:1.195
--- php4/ext/standard/basic_functions.c:1.194 Tue May 23 16:13:01 2000
+++ php4/ext/standard/basic_functions.c Fri May 26 10:04:01 2000
@@ -87,10 +87,8 @@
PHP_FE(time, NULL)
PHP_FE(mktime, NULL)
PHP_FE(gmmktime, NULL)
-#if HAVE_STRFTIME
PHP_FE(strftime, NULL)
PHP_FE(gmstrftime, NULL)
-#endif
PHP_FE(strtotime, NULL)
PHP_FE(date, NULL)
PHP_FE(gmdate, NULL)
@@ -202,10 +200,9 @@
PHP_FE(gethostbyaddr, NULL)
PHP_FE(gethostbyname, NULL)
PHP_FE(gethostbynamel, NULL)
-#if !defined(PHP_WIN32)||HAVE_BINDLIB
+
PHP_FE(checkdnsrr, NULL)
PHP_FE(getmxrr, second_and_third_args_force_ref)
-#endif
PHP_FE(getmyuid, NULL)
PHP_FE(getmypid, NULL)
@@ -246,15 +243,12 @@
PHP_FE(long2ip, NULL)
PHP_FE(getenv, NULL)
-#ifdef HAVE_PUTENV
PHP_FE(putenv, NULL)
-#endif
PHP_FE(microtime, NULL)
PHP_FE(gettimeofday, NULL)
-#ifdef HAVE_GETRUSAGE
+
PHP_FE(getrusage, NULL)
-#endif
PHP_FE(uniqid, NULL)
@@ -328,10 +322,8 @@
PHP_FALIAS(join, implode, NULL)
PHP_FE(sql_regcase, NULL)
-#ifdef HAVE_LIBDL
/* functions from dl.c */
PHP_FE(dl, NULL)
-#endif
/* functions from file.c */
PHP_FE(pclose, NULL)
@@ -367,9 +359,7 @@
use socket_set_blocking() instead */
PHP_FE(set_socket_blocking, NULL)
PHP_FE(socket_set_blocking, NULL)
-#if HAVE_SYS_TIME_H
PHP_FE(socket_set_timeout, NULL)
-#endif
PHP_FE(socket_get_status, NULL)
PHP_FE(realpath, NULL)
@@ -384,10 +374,8 @@
/* functions from browscap.c */
PHP_FE(get_browser, NULL)
-#if HAVE_CRYPT
/* functions from crypt.c */
PHP_FE(crypt, NULL)
-#endif
/* functions from dir.c */
PHP_FE(opendir, NULL)
@@ -804,12 +792,12 @@
}
/* }}} */
-#ifdef HAVE_PUTENV
/* {{{ proto void putenv(string setting)
Set the value of an environment variable */
PHP_FUNCTION(putenv)
{
+#ifdef HAVE_PUTENV
pval **str;
BLS_FETCH();
@@ -883,9 +871,11 @@
RETURN_FALSE;
}
}
+#else
+ PHP_NOT_IN_THIS_BUILD;
+#endif
}
/* }}} */
-#endif
/*******************
Index: php4/ext/standard/crypt.c
diff -u php4/ext/standard/crypt.c:1.24 php4/ext/standard/crypt.c:1.25
--- php4/ext/standard/crypt.c:1.24 Thu May 18 08:34:35 2000
+++ php4/ext/standard/crypt.c Fri May 26 10:04:02 2000
@@ -17,7 +17,7 @@
| Rasmus Lerdorf <[email protected]> |
+----------------------------------------------------------------------+
*/
-/* $Id: crypt.c,v 1.24 2000/05/18 15:34:35 zeev Exp $ */
+/* $Id: crypt.c,v 1.25 2000/05/26 17:04:02 hholzgra Exp $ */
#include <stdlib.h>
#include "php.h"
@@ -115,11 +115,13 @@
v >>= 6;
}
}
+#endif /* HAVE_CRYPT */
/* {{{ proto string crypt(string str [, string salt])
Encrypt a string */
PHP_FUNCTION(crypt)
{
+#if HAVE_CRYPT
char salt[PHP_MAX_SALT_LEN+1];
pval **arg1, **arg2;
@@ -176,9 +178,11 @@
return_value->value.str.len = strlen(return_value->value.str.val);
return_value->type = IS_STRING;
pval_copy_constructor(return_value);
+#else
+ PHP_NOT_IN_THIS_BUILD;
+#endif /* HAVE_CRYPT */
}
/* }}} */
-#endif
Index: php4/ext/standard/datetime.c
diff -u php4/ext/standard/datetime.c:1.38 php4/ext/standard/datetime.c:1.39
--- php4/ext/standard/datetime.c:1.38 Thu May 18 08:34:35 2000
+++ php4/ext/standard/datetime.c Fri May 26 10:04:02 2000
@@ -19,7 +19,7 @@
*/
-/* $Id: datetime.c,v 1.38 2000/05/18 15:34:35 zeev Exp $ */
+/* $Id: datetime.c,v 1.39 2000/05/26 17:04:02 hholzgra Exp $ */
#include "php.h"
@@ -677,11 +677,17 @@
efree(buf);
RETURN_FALSE;
}
+#endif
+
/* {{{ proto string strftime(string format [, int timestamp])
Format a local time/date according to locale settings */
PHP_FUNCTION(strftime)
{
+#if HAVE_STRFTIME
_php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+#else
+ PHP_NOT_IN_THIS_BUILD;
+#endif
}
/* }}} */
@@ -689,11 +695,14 @@
Format a GMT/CUT time/date according to locale settings */
PHP_FUNCTION(gmstrftime)
{
+#if HAVE_STRFTIME
_php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+#else
+ PHP_NOT_IN_THIS_BUILD;
+#endif
}
/* }}} */
-#endif
/* {{{ proto int strtotime(string time, int now)
Convert string representation of date and time to a timestamp */
Index: php4/ext/standard/dl.h
diff -u php4/ext/standard/dl.h:1.9 php4/ext/standard/dl.h:1.10
--- php4/ext/standard/dl.h:1.9 Mon Mar 6 12:37:11 2000
+++ php4/ext/standard/dl.h Fri May 26 10:04:02 2000
@@ -30,19 +30,19 @@
*/
-/* $Id: dl.h,v 1.9 2000/03/06 20:37:11 ssb Exp $ */
+/* $Id: dl.h,v 1.10 2000/05/26 17:04:02 hholzgra Exp $ */
#ifndef _DL_H
#define _DL_H
void php_dl(pval *file,int type,pval *return_value);
-#ifdef HAVE_LIBDL
/* dynamic loading functions */
PHP_FUNCTION(dl);
-PHP_MINFO_FUNCTION(dl);
+#ifdef HAVE_LIBDL
+PHP_MINFO_FUNCTION(dl);
#else
#endif
Index: php4/ext/standard/dns.c
diff -u php4/ext/standard/dns.c:1.18 php4/ext/standard/dns.c:1.19
--- php4/ext/standard/dns.c:1.18 Thu May 18 08:34:35 2000
+++ php4/ext/standard/dns.c Fri May 26 10:04:02 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dns.c,v 1.18 2000/05/18 15:34:35 zeev Exp $ */
+/* $Id: dns.c,v 1.19 2000/05/26 17:04:02 hholzgra Exp $ */
#include "php.h"
#if HAVE_SYS_SOCKET_H
@@ -159,12 +159,12 @@
return estrdup(inet_ntoa(in));
}
-#if !defined(PHP_WIN32)||HAVE_BINDLIB
/* {{{ proto int checkdnsrr(string host [, string type])
Check DNS records corresponding to a given Internet host name or IP address */
PHP_FUNCTION(checkdnsrr)
{
+#if !defined(PHP_WIN32)||HAVE_BINDLIB
pval **arg1,**arg2;
int type,i;
#ifndef MAXPACKET
@@ -206,9 +206,14 @@
RETURN_FALSE;
}
RETURN_TRUE;
+#else
+ PHP_NOT_IN_THIS_BUILD;
+#endif
}
/* }}} */
+#if !defined(PHP_WIN32)||HAVE_BINDLIB
+
#ifndef HFIXEDSZ
#define HFIXEDSZ 12 /* fixed data in header <arpa/nameser.h> */
#endif /* HFIXEDSZ */
@@ -220,11 +225,13 @@
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif /* MAXHOSTNAMELEN */
+#endif
/* {{{ proto int getmxrr(string hostname, array mxhosts [, array weight])
Get MX records corresponding to a given Internet host name */
PHP_FUNCTION(getmxrr)
{
+#if !defined(PHP_WIN32)||HAVE_BINDLIB
pval *host, *mx_list, *weight_list;
int need_weight = 0;
int count,qdc;
@@ -307,10 +314,12 @@
}
}
RETURN_TRUE;
+#else
+ PHP_NOT_IN_THIS_BUILD;
+#endif
}
/* }}} */
-#endif
/*
* Local variables:
* tab-width: 4
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.81 php4/ext/standard/file.c:1.82
--- php4/ext/standard/file.c:1.81 Tue May 23 16:13:01 2000
+++ php4/ext/standard/file.c Fri May 26 10:04:02 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.81 2000/05/23 23:13:01 hholzgra Exp $ */
+/* $Id: file.c,v 1.82 2000/05/26 17:04:02 hholzgra Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -845,9 +845,9 @@
/* {{{ proto bool socket_set_timeout(int socket descriptor, int seconds, int microseconds)
Set timeout on socket read to seconds + microseonds */
-#if HAVE_SYS_TIME_H
PHP_FUNCTION(socket_set_timeout)
{
+#if HAVE_SYS_TIME_H
zval **socket, **seconds, **microseconds;
int type;
void *what;
@@ -876,8 +876,10 @@
php_sockset_timeout(socketd, &t);
RETURN_TRUE;
-}
+#else
+ PHP_NOT_IN_THIS_BUILD;
#endif /* HAVE_SYS_TIME_H */
+}
/* }}} */
Index: php4/ext/standard/microtime.c
diff -u php4/ext/standard/microtime.c:1.23 php4/ext/standard/microtime.c:1.24
--- php4/ext/standard/microtime.c:1.23 Thu May 18 08:34:35 2000
+++ php4/ext/standard/microtime.c Fri May 26 10:04:02 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: microtime.c,v 1.23 2000/05/18 15:34:35 zeev Exp $ */
+/* $Id: microtime.c,v 1.24 2000/05/26 17:04:02 hholzgra Exp $ */
#include "php.h"
@@ -89,11 +89,11 @@
}
/* }}} */
-#ifdef HAVE_GETRUSAGE
/* {{{ proto array getrusage([int who])
Returns an array of usage statistics */
PHP_FUNCTION(getrusage)
{
+#ifdef HAVE_GETRUSAGE
struct rusage usg;
int ac = ARG_COUNT(ht);
pval **pwho;
@@ -133,8 +133,10 @@
PHP_RUSAGE_PARA(ru_stime.tv_usec);
PHP_RUSAGE_PARA(ru_stime.tv_sec);
#undef PHP_RUSAGE_PARA
-}
+#else
+ PHP_NOT_IN_THIS_BUILD;
#endif /* HAVE_GETRUSAGE */
+}
/* }}} */
Index: php4/ext/standard/php_crypt.h
diff -u php4/ext/standard/php_crypt.h:1.4 php4/ext/standard/php_crypt.h:1.5
--- php4/ext/standard/php_crypt.h:1.4 Thu May 18 08:34:35 2000
+++ php4/ext/standard/php_crypt.h Fri May 26 10:04:02 2000
@@ -21,8 +21,8 @@
#ifndef PHP_CRYPT_H
#define PHP_CRYPT_H
-#if HAVE_CRYPT
PHP_FUNCTION(crypt);
+#if HAVE_CRYPT
extern PHP_MINIT_FUNCTION(crypt);
#endif