cvs: /php4/ext/standard file.c file.h
| From: | Evan Klinger | Date: | Wed, 24 Nov 1999 03:47:59 +0000 |
| Subject: | cvs: /php4/ext/standard file.c file.h | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6818@lists.php.net to get a copy of this message | ||
evan Tue Nov 23 22:47:59 1999 EDT
Modified files:
/php4/ext/standard file.c file.h
Log:
Can't forget fd_isset()
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.40 php4/ext/standard/file.c:1.41
--- php4/ext/standard/file.c:1.40 Tue Nov 23 22:05:10 1999
+++ php4/ext/standard/file.c Tue Nov 23 22:47:58 1999
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.40 1999/11/24 03:05:10 evan Exp $ */
+/* $Id: file.c,v 1.41 1999/11/24 03:47:58 evan Exp $ */
/* Synced with php3 revision 1.218 1999-06-16 [ssb] */
@@ -245,6 +245,7 @@
PHP_FE(set_socket_timeout, NULL)
#endif
PHP_FE(fd_set, NULL)
+ PHP_FE(fd_isset, NULL)
PHP_FE(select, NULL)
{NULL, NULL, NULL}
};
@@ -1681,7 +1682,7 @@
if(getParametersEx(1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
- what =
zend_fetch_resource(arg,-1,"Select",&type,3,le_fopen,le_socket,le_popen);
+ what =
zend_fetch_resource(arg,-1,"select",&type,3,le_fopen,le_socket,le_popen);
ZEND_VERIFY_RESOURCE(what);
if(type == le_socket) {
fd = *(int *)what;
@@ -1733,3 +1734,27 @@
RETURN_LONG(select(max_fd + 1,&readfd,NULL,NULL,((*timeout)->value.lval <= 0) ? NULL :
&tv));
}
+PHP_FUNCTION(fd_isset)
+{
+ pval **fdarg;
+ void *what;
+ int type, fd;
+
+ if(ARG_COUNT(ht) != 1 || getParametersEx(1, &fdarg) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ what = zend_fetch_resource(fdarg,-1,"select",&type,3,le_fopen,le_socket,le_popen);
+ ZEND_VERIFY_RESOURCE(what);
+
+ if(type == le_socket) {
+ fd = *(int *)what;
+ } else {
+ fd = fileno((FILE *)what);
+ }
+
+ if(FD_ISSET(fd,&readfd)) {
+ RETURN_TRUE;
+ }
+ RETURN_FALSE;
+}
Index: php4/ext/standard/file.h
diff -u php4/ext/standard/file.h:1.13 php4/ext/standard/file.h:1.14
--- php4/ext/standard/file.h:1.13 Tue Nov 23 22:05:10 1999
+++ php4/ext/standard/file.h Tue Nov 23 22:47:58 1999
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.h,v 1.13 1999/11/24 03:05:10 evan Exp $ */
+/* $Id: file.h,v 1.14 1999/11/24 03:47:58 evan Exp $ */
/* Synced with php3 revision 1.30 1999-06-16 [ssb] */
@@ -69,6 +69,7 @@
PHP_FUNCTION(get_meta_tags);
PHP_FUNCTION(flock);
PHP_FUNCTION(fd_set);
+PHP_FUNCTION(fd_isset);
PHP_FUNCTION(select);
PHPAPI int _php3_set_sock_blocking(int socketd, int block);