mirror of
https://github.com/php-win-ext/pecl-expect.git
synced 2026-03-24 05:02:05 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea50047133 | ||
|
|
e16b06dede | ||
|
|
80e342cf6b | ||
|
|
3e030e95e6 |
29
expect.c
29
expect.c
@@ -33,7 +33,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_expect_expectl, 0, 0, 2)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
/* {{{ expect_functions[] */
|
||||
function_entry expect_functions[] = {
|
||||
zend_function_entry expect_functions[] = {
|
||||
PHP_FE(expect_popen, arginfo_expect_popen)
|
||||
PHP_FE(expect_expectl, arginfo_expect_expectl)
|
||||
{ NULL, NULL, NULL }
|
||||
@@ -61,6 +61,26 @@ zend_module_entry expect_module_entry = {
|
||||
ZEND_GET_MODULE(expect)
|
||||
#endif
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(expect)
|
||||
|
||||
/* {{{ php_expect_init_globals
|
||||
*/
|
||||
static void php_expect_init_globals (zend_expect_globals *globals TSRMLS_DC)
|
||||
{
|
||||
globals->logfile_stream = NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_expect_destroy_globals
|
||||
*/
|
||||
static void php_expect_destroy_globals(zend_expect_globals *globals TSRMLS_DC)
|
||||
{
|
||||
if (globals->logfile_stream) {
|
||||
php_stream_close(globals->logfile_stream);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_INI_MH
|
||||
* */
|
||||
static PHP_INI_MH(OnSetExpectTimeout)
|
||||
@@ -91,8 +111,11 @@ static PHP_INI_MH(OnSetExpectLogUser)
|
||||
* */
|
||||
static PHP_INI_MH(OnSetExpectLogFile)
|
||||
{
|
||||
if (EXPECT_G(logfile_stream)) {
|
||||
php_stream_close(EXPECT_G(logfile_stream));
|
||||
}
|
||||
if (new_value_length > 0) {
|
||||
php_stream *stream = php_stream_open_wrapper (new_value, "a", 0, NULL);
|
||||
php_stream* stream = php_stream_open_wrapper (new_value, "a", 0, NULL);
|
||||
if (!stream) {
|
||||
php_error_docref (NULL TSRMLS_CC, E_ERROR, "could not open log file for writing");
|
||||
return FAILURE;
|
||||
@@ -101,8 +124,10 @@ static PHP_INI_MH(OnSetExpectLogFile)
|
||||
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void **) &exp_logfile, REPORT_ERRORS) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
EXPECT_G(logfile_stream) = stream;
|
||||
exp_logfile_all = 1;
|
||||
} else {
|
||||
EXPECT_G(logfile_stream) = NULL;
|
||||
exp_logfile = NULL;
|
||||
exp_logfile_all = 0;
|
||||
}
|
||||
|
||||
85
package.xml
85
package.xml
@@ -1,34 +1,53 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0">
|
||||
<package>
|
||||
<name>expect</name>
|
||||
<summary>PHP extension for expect library</summary>
|
||||
<description>This extension allows to interact with processes through PTY, using expect library.</description>
|
||||
<license>PHP License</license>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>michael</user>
|
||||
<name>Michael Spector</name>
|
||||
<email>michael@php.net</email>
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
|
||||
<release>
|
||||
<version>0.2.5</version>
|
||||
<date>2008-11-27</date>
|
||||
<state>beta</state>
|
||||
<notes>Fixed bug #14768 (configure error in Ubuntu 8.04)
|
||||
</notes>
|
||||
</release>
|
||||
|
||||
<filelist>
|
||||
<dir role="doc" name="/">
|
||||
<file role="src">config.m4</file>
|
||||
<file role="src">expect.dsp</file>
|
||||
<file role="src">config.w32</file>
|
||||
<file role="src">expect.c</file>
|
||||
<file role="src">expect_fopen_wrapper.c</file>
|
||||
<file role="src">php_expect.h</file>
|
||||
</dir>
|
||||
</filelist>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
|
||||
http://pear.php.net/dtd/tasks-1.0.xsd
|
||||
http://pear.php.net/dtd/package-2.0
|
||||
http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<name>expect</name>
|
||||
<channel>pecl.php.net</channel>
|
||||
<summary>PHP extension for expect library</summary>
|
||||
<description>This extension allows to interact with processes through PTY, using expect library.
|
||||
</description>
|
||||
<lead>
|
||||
<name>Michael Spector</name>
|
||||
<user>michael</user>
|
||||
<email>michael@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2010-10-10</date>
|
||||
<time>09:28:00</time>
|
||||
<version>
|
||||
<release>0.2.7</release>
|
||||
<api>0.2.7</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<notes>
|
||||
Fixed bug #18998 (Change expect.logfile on runtime leave file descriptor opened)
|
||||
</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
<file name="config.m4" role="src" />
|
||||
<file name="config.w32" role="src" />
|
||||
<file name="expect.c" role="src" />
|
||||
<file name="expect.dsp" role="src" />
|
||||
<file name="expect_fopen_wrapper.c" role="src" />
|
||||
<file name="php_expect.h" role="src" />
|
||||
</dir> <!-- / -->
|
||||
</contents>
|
||||
<dependencies>
|
||||
<required>
|
||||
<php>
|
||||
<min>4.0.0</min>
|
||||
</php>
|
||||
<pearinstaller>
|
||||
<min>1.4.0b1</min>
|
||||
</pearinstaller>
|
||||
</required>
|
||||
</dependencies>
|
||||
<providesextension>expect</providesextension>
|
||||
<extsrcrelease />
|
||||
</package>
|
||||
|
||||
12
php_expect.h
12
php_expect.h
@@ -35,7 +35,7 @@
|
||||
extern zend_module_entry expect_module_entry;
|
||||
#define phpext_expect_ptr &expect_module_entry
|
||||
|
||||
#define PHP_EXPECT_VERSION "0.2.5-dev"
|
||||
#define PHP_EXPECT_VERSION "0.2.7-dev"
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_EXPECT_API __declspec(dllexport)
|
||||
@@ -52,6 +52,16 @@ PHP_FUNCTION(expect_expectl);
|
||||
|
||||
extern php_stream_wrapper php_expect_wrapper;
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(expect)
|
||||
php_stream* logfile_stream;
|
||||
ZEND_END_MODULE_GLOBALS(expect)
|
||||
|
||||
#ifdef ZTS
|
||||
#define EXPECT_G(v) TSRMG(expect_globals_id, zend_expect_globals *, v)
|
||||
#else
|
||||
#define EXPECT_G(v) (expect_globals.v)
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif /* ZTS */
|
||||
|
||||
Reference in New Issue
Block a user