package.xml0000644000175000017500000000350011662746575013002 0ustar michaelmichael expect pecl.php.net PHP extension for expect library This extension allows to interact with processes through PTY, using expect library. Michael Spector michael michael@php.net yes 2011-11-22 0.3.1 0.3.1 beta beta PHP License Fixed compilation issue (Bug #59916) 4.0.0 1.4.0b1 expect expect-0.3.1/config.m40000644000175000017500000000240711662746575014326 0ustar michaelmichaeldnl dnl $Id: config.m4 319689 2011-11-22 16:27:35Z michael $ dnl PHP_ARG_WITH(expect,for expect support, [ --with-expect[=DIR] Include expect support (requires libexpect >= 5.43.0).]) PHP_ARG_WITH(tcldir,specify path to Tcl needed by expect, [ --with-tcldir[=DIR] Specify path to Tcl config script (tclConfig.sh).]) if test "$PHP_EXPECT" != "no"; then for i in $PHP_EXPECT/include/expect.h $PHP_EXPECT/include/*/expect.h \ /usr/local/include/expect.h /usr/local/include/*/expect.h \ /usr/include/expect.h /usr/include/*/expect.h ; do if test -f $i; then LIBEXPECT_INCLUDE_DIR=`dirname $i` LIBEXPECT_DIR=`dirname $LIBEXPECT_INCLUDE_DIR` break fi done for i in $PHP_TCLDIR/tclConfig.sh /usr/lib/tcl*/tclConfig.sh \ /usr/local/lib/tcl*/tclConfig.sh \ /System/Library/Frameworks/Tcl.framework/Versions/Current/tclConfig.sh; do if test -f $i; then . $i break fi done PHP_ADD_LIBRARY_WITH_PATH(tcl$TCL_VERSION, $TCL_PREFIX/lib, EXPECT_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH(expect, $LIBEXPECT_DIR/lib, EXPECT_SHARED_LIBADD) PHP_ADD_INCLUDE($LIBEXPECT_INCLUDE_DIR) PHP_NEW_EXTENSION(expect, expect.c expect_fopen_wrapper.c, $ext_shared) PHP_SUBST(EXPECT_SHARED_LIBADD) fi expect-0.3.1/config.w320000644000175000017500000000060311662746575014415 0ustar michaelmichael// $ Id: $ // vim:ft=javascript ARG_WITH('expect' , 'expect support', 'no'); if (PHP_EXPECT != "no") { if (CHECK_HEADER_ADD_INCLUDE("expect.h", "CFLAGS_EXPECT", PHP_EXPECT) && CHECK_LIB("expect.lib", "expect", PHP_EXPECT)) { EXTENSION("expect", "expect.c", PHP_EXPECT_SHARED, null, "php_expect.dll"); } else { WARNING("expect not enabled; libraries and headers not found"); } } expect-0.3.1/expect.c0000644000175000017500000002536311662746575014261 0ustar michaelmichael/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2004 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_0.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 | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Michael Spector | +----------------------------------------------------------------------+ */ /* $ Id: $ */ #include "php_expect.h" #include #include ZEND_BEGIN_ARG_INFO_EX(arginfo_expect_popen, 0, 0, 1) ZEND_ARG_INFO(0, command) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_expect_expectl, 0, 0, 2) ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, expect_cases) ZEND_ARG_INFO(1, match) ZEND_END_ARG_INFO() /* {{{ expect_functions[] */ zend_function_entry expect_functions[] = { PHP_FE(expect_popen, arginfo_expect_popen) PHP_FE(expect_expectl, arginfo_expect_expectl) { NULL, NULL, NULL } }; /* }}} */ /* {{{ expect_module_entry */ zend_module_entry expect_module_entry = { STANDARD_MODULE_HEADER, "expect", expect_functions, PHP_MINIT(expect), PHP_MSHUTDOWN(expect), NULL, NULL, PHP_MINFO(expect), PHP_EXPECT_VERSION, STANDARD_MODULE_PROPERTIES }; /* }}} */ #ifdef COMPILE_DL_EXPECT 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) { if (new_value) { exp_timeout = atoi(new_value); return SUCCESS; } return FAILURE; } /* }}} */ /* {{{ PHP_INI_MH * */ static PHP_INI_MH(OnSetExpectMatchMax) { if (new_value) { exp_match_max = atoi(new_value); return SUCCESS; } return FAILURE; } /* }}} */ /* {{{ PHP_INI_MH * */ static PHP_INI_MH(OnSetExpectLogUser) { if (new_value) { if (strncasecmp("on", new_value, sizeof("on"))) { exp_loguser = atoi(new_value); } else { exp_loguser = 1; } return SUCCESS; } return FAILURE; } /* }}} */ /* {{{ PHP_INI_MH * */ 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); if (!stream) { php_error_docref (NULL TSRMLS_CC, E_ERROR, "could not open log file for writing"); return FAILURE; } stream->flags |= PHP_STREAM_FLAG_NO_SEEK; 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; } return SUCCESS; } /* }}} */ PHP_INI_BEGIN() PHP_INI_ENTRY("expect.timeout", "10", PHP_INI_ALL, OnSetExpectTimeout) PHP_INI_ENTRY_EX("expect.loguser", "1", PHP_INI_ALL, OnSetExpectLogUser, php_ini_boolean_displayer_cb) PHP_INI_ENTRY("expect.logfile", "", PHP_INI_ALL, OnSetExpectLogFile) PHP_INI_ENTRY("expect.match_max", "5000", PHP_INI_ALL, OnSetExpectMatchMax) PHP_INI_END() /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(expect) { php_register_url_stream_wrapper("expect", &php_expect_wrapper TSRMLS_CC); REGISTER_LONG_CONSTANT("EXP_GLOB", exp_glob, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("EXP_EXACT", exp_exact, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("EXP_REGEXP", exp_regexp, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("EXP_EOF", EXP_EOF, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("EXP_TIMEOUT", EXP_TIMEOUT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("EXP_FULLBUFFER", EXP_FULLBUFFER, CONST_CS | CONST_PERSISTENT); REGISTER_INI_ENTRIES(); Tcl_Interp *interp = Tcl_CreateInterp(); if (Tcl_Init(interp) == TCL_ERROR) { php_error_docref (NULL TSRMLS_CC, E_ERROR, "Unable to initialize TCL interpreter: %s", Tcl_GetStringResult (interp)); return FAILURE; } if (Expect_Init(interp) == TCL_ERROR) { php_error_docref (NULL TSRMLS_CC, E_ERROR, "Unable to initialize Expect: %s", Tcl_GetStringResult (interp)); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION(expect) { php_unregister_url_stream_wrapper("expect" TSRMLS_CC); UNREGISTER_INI_ENTRIES(); return SUCCESS; } /* }}} */ /* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(expect) { php_info_print_table_start(); php_info_print_table_header(2, "Expect support", "enabled"); php_info_print_table_row(2, "Version", PHP_EXPECT_VERSION); php_info_print_table_row(2, "Stream wrapper support", "expect://"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); } /* }}} */ /* {{{ * proto resource expect_popen (string command) */ PHP_FUNCTION(expect_popen) { char *command = NULL; int command_len; FILE *fp; php_stream *stream = NULL; zval *z_pid; if (ZEND_NUM_ARGS() != 1) { WRONG_PARAM_COUNT; } if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) { return; } if ((fp = exp_popen (command)) != NULL) { stream = php_stream_fopen_from_pipe (fp, ""); } if (!stream) { RETURN_FALSE; } stream->flags |= PHP_STREAM_FLAG_NO_SEEK; MAKE_STD_ZVAL (z_pid); ZVAL_LONG (z_pid, exp_pid); stream->wrapperdata = z_pid; php_stream_to_zval(stream, return_value); } /* }}} */ /* {{{ * proto mixed expect_expectl (resource stream, array expect_cases [, array match]) */ PHP_FUNCTION(expect_expectl) { struct exp_case *ecases, *ecases_ptr, matchedcase; zval *z_stream, *z_cases, *z_match=NULL, **z_case, **z_value; php_stream *stream; int fd, argc; ulong key; if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3) { WRONG_PARAM_COUNT; } if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ra|z", &z_stream, &z_cases, &z_match) == FAILURE) { return; } php_stream_from_zval (stream, &z_stream); if (!stream->wrapperdata) { php_error_docref (NULL TSRMLS_CC, E_ERROR, "supplied argument is not a valid stream resource"); return; } if (php_stream_cast (stream, PHP_STREAM_AS_FD, (void*)&fd, REPORT_ERRORS) != SUCCESS || fd < 0) { return; } argc = zend_hash_num_elements (Z_ARRVAL_P(z_cases)); ecases = (struct exp_case*) safe_emalloc (argc + 1, sizeof(struct exp_case), 0); ecases_ptr = ecases; zend_hash_internal_pointer_reset (Z_ARRVAL_P(z_cases)); while (zend_hash_get_current_data (Z_ARRVAL_P(z_cases), (void **)&z_case) == SUCCESS) { zval **z_pattern, **z_exp_type; zend_hash_get_current_key(Z_ARRVAL_P(z_cases), NULL, &key, 0); if (Z_TYPE_PP(z_case) != IS_ARRAY) { efree (ecases); php_error_docref (NULL TSRMLS_CC, E_ERROR, "expect case must be an array"); return; } ecases_ptr->re = NULL; ecases_ptr->type = exp_glob; /* Gather pattern */ if (zend_hash_index_find(Z_ARRVAL_PP(z_case), 0, (void **)&z_pattern) != SUCCESS) { efree (ecases); php_error_docref (NULL TSRMLS_CC, E_ERROR, "missing parameter for pattern at index: 0"); return; } if (Z_TYPE_PP(z_pattern) != IS_STRING) { efree (ecases); php_error_docref (NULL TSRMLS_CC, E_ERROR, "pattern must be of string type"); return; } ecases_ptr->pattern = Z_STRVAL_PP(z_pattern); /* Gather value */ if (zend_hash_index_find(Z_ARRVAL_PP(z_case), 1, (void **)&z_value) != SUCCESS) { efree (ecases); php_error_docref (NULL TSRMLS_CC, E_ERROR, "missing parameter for value at index: 1"); return; } ecases_ptr->value = key; /* Gather expression type (optional, default: EXPECT_GLOB) */ if (zend_hash_index_find(Z_ARRVAL_PP(z_case), 2, (void **)&z_exp_type) == SUCCESS) { if (Z_TYPE_PP(z_exp_type) != IS_LONG) { efree (ecases); php_error_docref (NULL TSRMLS_CC, E_ERROR, "expression type must be an integer constant"); return; } if (Z_LVAL_PP(z_exp_type) != exp_glob && Z_LVAL_PP(z_exp_type) != exp_exact && Z_LVAL_PP(z_exp_type) != exp_regexp) { efree (ecases); php_error_docref (NULL TSRMLS_CC, E_ERROR, "expression type must be either EXPECT_GLOB, EXPECT_EXACT or EXPECT_REGEXP"); return; } ecases_ptr->type = Z_LVAL_PP(z_exp_type); } ecases_ptr++; zend_hash_move_forward(Z_ARRVAL_P(z_cases)); } ecases_ptr->pattern = NULL; ecases_ptr->re = NULL; ecases_ptr->value = NULL; ecases_ptr->type = exp_end; key = exp_expectv (fd, ecases); int exp_match_len = exp_match_end - exp_match; if (key >= 0 && z_match && exp_match && exp_match_len > 0) { char *tmp = (char *)emalloc (sizeof(char) * (exp_match_len + 1)); strlcpy (tmp, exp_match, exp_match_len + 1); zval_dtor (z_match); array_init(z_match); add_index_string(z_match, 0, tmp, 1); /* Get case that was matched */ matchedcase = ecases[key]; /* If there are subpattern matches ... */ if (matchedcase.re != NULL && matchedcase.re->startp != NULL) { int i; /* iterate across all possible 9 subpatterns (a limitation of libexpect) and add matching substring to matches array */ for (i = 1; i <= 9; i++) { if (matchedcase.re->startp[i] != NULL) { int sub_match_len = matchedcase.re->endp[i] - matchedcase.re->startp[i]; char *sub_match = (char *)emalloc (sizeof(char) * (sub_match_len + 1)); strlcpy (sub_match, matchedcase.re->startp[i], sub_match_len + 1); add_next_index_string(z_match, sub_match, 1); efree (sub_match); } } } efree (tmp); } if (zend_hash_index_find (Z_ARRVAL_P(z_cases), key, (void **)&z_case) == SUCCESS) { if (zend_hash_index_find(Z_ARRVAL_PP(z_case), 1, (void **)&z_value) == SUCCESS) { *return_value = **z_value; zval_copy_ctor (return_value); } } else { RETURN_LONG (key); } // Free compiled patterns: ecases_ptr = ecases; while (ecases_ptr != NULL && ecases_ptr->type != exp_end) { if (ecases_ptr->re != NULL) { free(ecases_ptr->re); } ecases_ptr++; } efree (ecases); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ expect-0.3.1/expect.dsp0000644000175000017500000001064011662746575014615 0ustar michaelmichael# Microsoft Developer Studio Project File - Name="expect" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=expect - Win32 Debug_TS !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "expect.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "expect.mak" CFG="expect - Win32 Debug_TS" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "expect - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "expect - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "expect - Win32 Release_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release_TS" # PROP BASE Intermediate_Dir "Release_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release_TS" # PROP Intermediate_Dir "Release_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPECT_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_EXPECT" /D ZTS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD RSC /l 0x407 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_expect.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" !ELSEIF "$(CFG)" == "expect - Win32 Debug_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug_TS" # PROP BASE Intermediate_Dir "Debug_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug_TS" # PROP Intermediate_Dir "Debug_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPECT_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_EXPECT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD RSC /l 0x407 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_expect.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" !ENDIF # Begin Target # Name "expect - Win32 Release_TS" # Name "expect - Win32 Debug_TS" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=./expect.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\php_expect.h # End Source File # End Group # End Target # End Project expect-0.3.1/expect_fopen_wrapper.c0000644000175000017500000000506711662746575017207 0ustar michaelmichael/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2004 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_0.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 | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Michael Spector | +----------------------------------------------------------------------+ */ /* $Id: expect_fopen_wrapper.c 312443 2011-06-24 19:35:30Z michael $ */ #include "php.h" #include "php_expect.h" #include "php_streams.h" #include php_stream *php_expect_stream_open (php_stream_wrapper *wrapper, char *command, char *mode, int options, char **opened_command, php_stream_context *context STREAMS_DC TSRMLS_DC) { FILE *fp; if (strncasecmp("expect://", command, sizeof("expect://")-1) == 0) { command += sizeof("expect://")-1; } if ((fp = exp_popen(command)) != NULL) { php_stream* stream = php_stream_fopen_from_pipe (fp, mode); zval *z_pid; MAKE_STD_ZVAL (z_pid); ZVAL_LONG (z_pid, exp_pid); stream->wrapperdata = z_pid; return stream; } return NULL; } static int php_expect_stream_close (php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC) { zval* z_pid = stream->wrapperdata; int s = 0; waitpid (Z_LVAL_P(z_pid), &s, 0); zval_ptr_dtor (&z_pid); stream->wrapperdata = NULL; return s; } /* }}} */ static php_stream_wrapper_ops php_expect_wrapper_ops = { php_expect_stream_open, php_expect_stream_close, /* close */ NULL, /* stat */ NULL, /* stat_url */ NULL, /* opendir */ "expect", NULL, /* unlink */ NULL, /* rename */ NULL, /* mkdir */ NULL /* rmdir */ }; php_stream_wrapper php_expect_wrapper = { &php_expect_wrapper_ops, NULL, 0, /* is_url */ }; /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ expect-0.3.1/php_expect.h0000644000175000017500000000432311662746575015126 0ustar michaelmichael/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2004 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_0.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 | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Michael Spector | +----------------------------------------------------------------------+ */ /* $ Id: $ */ #ifndef PHP_EXPECT_H #define PHP_EXPECT_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include extern zend_module_entry expect_module_entry; #define phpext_expect_ptr &expect_module_entry #define PHP_EXPECT_VERSION "0.3.1-dev" #ifdef PHP_WIN32 #define PHP_EXPECT_API __declspec(dllexport) #else #define PHP_EXPECT_API #endif PHP_MINIT_FUNCTION(expect); PHP_MSHUTDOWN_FUNCTION(expect); PHP_MINFO_FUNCTION(expect); PHP_FUNCTION(expect_popen); 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 */ #endif /* PHP_EXPECT_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */