cvs: php4 / php.h /ext/standard/ Makefile.in basic_functions.c crypt.c datetime.c dl.h dns.c microtime.c php_noavail.c php_noavail.h

[email protected] ("Hartmut Holzgraefe")
Newsgroups php.version4
Message-ID <cvshholzgra959455640@cvsserver>
hholzgra		Sat May 27 12:27:20 2000 EDT

  Added files:
    /php4/ext/standard	php_noavail.c php_noavail.h 

  Modified files:
    /php4	php.h 
    /php4/ext/standard	Makefile.in basic_functions.c crypt.c datetime.c 
                      	dl.h dns.c microtime.c 
  Log:
  a second (cleaner?) try on warnings about unsupported functions
  
  
Index: php4/php.h
diff -u php4/php.h:1.97 php4/php.h:1.98
--- php4/php.h:1.97	Sat May 27 11:55:10 2000
+++ php4/php.h	Sat May 27 12:27:19 2000
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php.h,v 1.97 2000/05/27 18:55:10 andi Exp $ */
+/* $Id: php.h,v 1.98 2000/05/27 19:27:19 hholzgra Exp $ */
 
 #ifndef _PHP_H
 #define _PHP_H
@@ -366,11 +366,8 @@
 #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; \
-}
+/* warn about unavailable functions */
+#include "ext/standard/php_noavail.h"
 
 #endif
 
Index: php4/ext/standard/Makefile.in
diff -u php4/ext/standard/Makefile.in:1.10 php4/ext/standard/Makefile.in:1.11
--- php4/ext/standard/Makefile.in:1.10	Tue May 23 07:10:37 2000
+++ php4/ext/standard/Makefile.in	Sat May 27 12:27:20 2000
@@ -7,7 +7,7 @@
 	link.c mail.c math.c md5.c metaphone.c microtime.c pack.c pageinfo.c \
 	parsedate.c quot_print.c rand.c reg.c soundex.c string.c \
 	syslog.c type.c uniqid.c url.c url_scanner.c var.c output.c assert.c \
-	strnatcmp.c levenshtein.c
+	strnatcmp.c levenshtein.c php_noavail.c
 
 include $(top_srcdir)/build/dynlib.mk
 
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.196 php4/ext/standard/basic_functions.c:1.197
--- php4/ext/standard/basic_functions.c:1.196	Sat May 27 11:55:11 2000
+++ php4/ext/standard/basic_functions.c	Sat May 27 12:27:20 2000
@@ -87,8 +87,13 @@
 	PHP_FE(time,									NULL)
 	PHP_FE(mktime,									NULL)
 	PHP_FE(gmmktime,								NULL)
+#if HAVE_STRFTIME
 	PHP_FE(strftime,								NULL)
 	PHP_FE(gmstrftime,								NULL)
+#else
+	PHP_FALIAS(strftime  , warn_not_available,      NULL)                             
+	PHP_FALIAS(gmstrftime, warn_not_available,      NULL)                             
+#endif
 	PHP_FE(strtotime,								NULL)
 	PHP_FE(date,									NULL)
 	PHP_FE(gmdate,									NULL)
@@ -200,9 +205,13 @@
 	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)
+#else
+	PHP_FALIAS(checkdnsrr, warn_not_available,      NULL)                             
+	PHP_FALIAS(getmxrr,    warn_not_available,      NULL)                             
+#endif
 
 	PHP_FE(getmyuid,								NULL)
 	PHP_FE(getmypid,								NULL)
@@ -243,12 +252,19 @@
 	PHP_FE(long2ip,									NULL)
 
 	PHP_FE(getenv,									NULL)
+#ifdef HAVE_PUTENV
 	PHP_FE(putenv,									NULL)
+#else
+	PHP_FALIAS(putenv    , warn_not_available,      NULL)                             
+#endif
 
 	PHP_FE(microtime,								NULL)
 	PHP_FE(gettimeofday,							NULL)
-
+#ifdef HAVE_GETRUSAGE
 	PHP_FE(getrusage,								NULL)
+#else
+	PHP_FALIAS(getrusage , warn_not_available,      NULL)                             
+#endif
 	
 	PHP_FE(uniqid,									NULL)
 		
@@ -325,6 +341,7 @@
 	/* functions from dl.c */
 	PHP_FE(dl,							NULL)
 
+
 	/* functions from file.c */
 	PHP_FE(pclose,				NULL)
 	PHP_FE(popen,				NULL)
@@ -359,7 +376,11 @@
 	   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)
+#else
+	PHP_FALIAS(socket_set_timeout  , warn_not_available,      NULL)                             
+#endif
 	PHP_FE(socket_get_status,	NULL)
 	PHP_FE(realpath,			NULL)
 
@@ -374,8 +395,12 @@
 	/* functions from browscap.c */
 	PHP_FE(get_browser,			NULL)
 
+#if HAVE_CRYPT
 	/* functions from crypt.c */
 	PHP_FE(crypt,				NULL)
+#else
+	PHP_FALIAS(crypt  , warn_not_available,      NULL)                             
+#endif
 
 	/* functions from dir.c */
 	PHP_FE(opendir,				NULL)
@@ -792,12 +817,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();
 
@@ -871,11 +896,9 @@
 			RETURN_FALSE;
 		}
 	}
-#else
-    PHP_NOT_IN_THIS_BUILD();
-#endif
 }
 /* }}} */
+#endif
 
 
 /*******************
Index: php4/ext/standard/crypt.c
diff -u php4/ext/standard/crypt.c:1.26 php4/ext/standard/crypt.c:1.27
--- php4/ext/standard/crypt.c:1.26	Sat May 27 11:55:11 2000
+++ php4/ext/standard/crypt.c	Sat May 27 12:27:20 2000
@@ -17,7 +17,7 @@
    |          Rasmus Lerdorf <[email protected]>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: crypt.c,v 1.26 2000/05/27 18:55:11 andi Exp $ */
+/* $Id: crypt.c,v 1.27 2000/05/27 19:27:20 hholzgra Exp $ */
 #include <stdlib.h>
 
 #include "php.h"
@@ -115,13 +115,11 @@
 		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;
 
@@ -178,11 +176,9 @@
 	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.40 php4/ext/standard/datetime.c:1.41
--- php4/ext/standard/datetime.c:1.40	Sat May 27 11:55:11 2000
+++ php4/ext/standard/datetime.c	Sat May 27 12:27:20 2000
@@ -19,7 +19,7 @@
  */
 
 
-/* $Id: datetime.c,v 1.40 2000/05/27 18:55:11 andi Exp $ */
+/* $Id: datetime.c,v 1.41 2000/05/27 19:27:20 hholzgra Exp $ */
 
 
 #include "php.h"
@@ -677,17 +677,11 @@
 	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
 }
 /* }}} */
 
@@ -695,14 +689,11 @@
    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.10 php4/ext/standard/dl.h:1.11
--- php4/ext/standard/dl.h:1.10	Fri May 26 10:04:02 2000
+++ php4/ext/standard/dl.h	Sat May 27 12:27:20 2000
@@ -30,7 +30,7 @@
  */
 
 
-/* $Id: dl.h,v 1.10 2000/05/26 17:04:02 hholzgra Exp $ */
+/* $Id: dl.h,v 1.11 2000/05/27 19:27:20 hholzgra Exp $ */
 
 #ifndef _DL_H
 #define _DL_H
@@ -41,10 +41,6 @@
 /* dynamic loading functions */
 PHP_FUNCTION(dl);
 
-#ifdef HAVE_LIBDL
 PHP_MINFO_FUNCTION(dl);
-#else
-
-#endif
 
 #endif /* _DL_H */
Index: php4/ext/standard/dns.c
diff -u php4/ext/standard/dns.c:1.20 php4/ext/standard/dns.c:1.21
--- php4/ext/standard/dns.c:1.20	Sat May 27 11:55:11 2000
+++ php4/ext/standard/dns.c	Sat May 27 12:27:20 2000
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dns.c,v 1.20 2000/05/27 18:55:11 andi Exp $ */
+/* $Id: dns.c,v 1.21 2000/05/27 19:27:20 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,14 +206,9 @@
 		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 */
@@ -225,13 +220,11 @@
 #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;
@@ -314,12 +307,10 @@
 		}
 	}
 	RETURN_TRUE;
-#else
-    PHP_NOT_IN_THIS_BUILD();
-#endif
 }
 /* }}} */
 
+#endif
 /*
  * Local variables:
  * tab-width: 4
Index: php4/ext/standard/microtime.c
diff -u php4/ext/standard/microtime.c:1.25 php4/ext/standard/microtime.c:1.26
--- php4/ext/standard/microtime.c:1.25	Sat May 27 11:55:11 2000
+++ php4/ext/standard/microtime.c	Sat May 27 12:27:20 2000
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: microtime.c,v 1.25 2000/05/27 18:55:11 andi Exp $ */
+/* $Id: microtime.c,v 1.26 2000/05/27 19:27:20 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,10 +133,8 @@
 	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 */
 }
+#endif /* HAVE_GETRUSAGE */
 
 /* }}} */
 

Index: php4/ext/standard/php_noavail.c
+++ php4/ext/standard/php_noavail.c
/*
   +----------------------------------------------------------------------+
   | PHP version 4.0                                                      |
   +----------------------------------------------------------------------+
   | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group                   |
   +----------------------------------------------------------------------+
   | This source file is subject to version 2.02 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
   | available at through the world-wide-web at                           |
   | http://www.php.net/license/2_02.txt.                                 |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to          |
   | [email protected] so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
   | Authors: Hartmut Holzgraefe <[email protected]>                         |
   +----------------------------------------------------------------------+
*/

#include "php_noavail.h"

PHP_FUNCTION(warn_not_available)
{
php_error(E_WARNING, 
						"%s() is  not supported in this PHP build",
						get_active_function_name());
	RETURN_FALSE;
}                   

Index: php4/ext/standard/php_noavail.h
+++ php4/ext/standard/php_noavail.h
/*
   +----------------------------------------------------------------------+
   | PHP version 4.0                                                      |
   +----------------------------------------------------------------------+
   | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group                   |
   +----------------------------------------------------------------------+
   | This source file is subject to version 2.02 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
   | available at through the world-wide-web at                           |
   | http://www.php.net/license/2_02.txt.                                 |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to          |
   | [email protected] so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
   | Authors: Hartmut Holzgraefe <[email protected]>                         |
   +----------------------------------------------------------------------+
*/


#ifndef _PHP_NOAVAIL
#define _PHP_NOAVAIL

#include "php.h"

PHP_FUNCTION(warn_not_available);                                              

#endif /* _PHP_NOAVAIL */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.