cvs: php4 /ext/standard file.c

From: Date: Wed, 15 Aug 2001 05:21:44 +0000
Subject: cvs: php4 /ext/standard file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-6855@lists.php.net to get a copy of this message
sterling Wed Aug 15 01:21:44 2001 EDT Modified files: /php4/ext/standard file.c Log: Removed select(), fd_set(), etc. (wasn't present in the first place, and these are implemented in the sockwasn't present in the first place, and these are implemented in the sockets extension)) Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.182 php4/ext/standard/file.c:1.183 --- php4/ext/standard/file.c:1.182 Sat Aug 11 13:03:37 2001 +++ php4/ext/standard/file.c Wed Aug 15 01:21:43 2001 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.182 2001/08/11 17:03:37 zeev Exp $ */ +/* $Id: file.c,v 1.183 2001/08/15 05:21:43 sterling Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2231,117 +2231,6 @@ /* }}} */ #endif - -#if 0 - -static fd_set readfd; -static int max_fd; -/* {{{ PHP_FUNCTION(fd_set) - */ -PHP_FUNCTION(fd_set) -{ - pval **arg; - void *what; - int type, fd; - - if(ARG_COUNT(ht) <= 0) { - php_error(E_WARNING, "fd_set: Must be passed at least one value" ); - return_value->type = IS_NULL; - return; - } - else if(ARG_COUNT(ht) == 1) { - if(zend_get_parameters_ex(1, &arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - /* XXX: add stream support --Wez. */ - what = zend_fetch_resource(arg TSRMLS_CC,-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); - } - max_fd = fd; - FD_ZERO(&readfd); - FD_SET(max_fd, &readfd); - } - else { - pval ***args = (pval ***) emalloc(sizeof(pval **) * ARG_COUNT(ht)); - int i; - if(zend_get_parameters_array_ex(ARG_COUNT(ht), args) == FAILURE) { - efree(args); - WRONG_PARAM_COUNT; - } - FD_ZERO(&readfd); - for(i = 0; i < ARG_COUNT(ht); i++) { - /* XXX: add stream support --Wez. */ - what = zend_fetch_resource(*args TSRMLS_CC,-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); - } - FD_SET(fd, &readfd); - if(fd > max_fd) max_fd = fd; - } - efree(args); - } - RETURN_LONG(1); -} -/* }}} */ - -/* {{{ PHP_FUNCTION(select) - */ -PHP_FUNCTION(select) -{ - pval **timeout; - struct timeval tv; - - if(ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &timeout) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long_ex(timeout); - - tv.tv_sec = (*timeout)->value.lval / 1000000; - tv.tv_usec = (*timeout)->value.lval % 1000000; - /* XXX: add stream support --Wez. */ - - RETURN_LONG(select(max_fd + 1, &readfd, NULL, NULL, ((*timeout)->value.lval <= 0) ? NULL : &tv)); -} -/* }}} */ - -/* {{{ PHP_FUNCTION(fd_isset) - */ -PHP_FUNCTION(fd_isset) -{ - pval **fdarg; - void *what; - int type, fd; - - if(ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &fdarg) == FAILURE) { - WRONG_PARAM_COUNT; - } - /* XXX: add stream support --Wez. */ - - what = zend_fetch_resource(fdarg TSRMLS_CC,-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; -} -/* }}} */ - -#endif /* {{{ php_fread_all Function reads all data from file or socket and puts it into the buffer */

« previous php.cvs (#6855) next »