CVS update: php31/main
| From: | shane | Date: | Fri, 21 Aug 1998 17:16:59 +0000 |
| Subject: | CVS update: php31/main | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-429@lists.php.net to get a copy of this message | ||
Date: Friday August 21, 1998 @ 13:16
Author: shane
Update of /repository/php31/main
In directory asf:/tmp/cvs-serv28380/main
Modified Files:
main.c
Log Message:
interactive mode works again
Index: php31/main/main.c
diff -c php31/main/main.c:2.15 php31/main/main.c:2.16
*** php31/main/main.c:2.15 Fri Aug 21 12:52:23 1998
--- php31/main/main.c Fri Aug 21 13:16:59 1998
***************
*** 29,35 ****
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 2.15 1998/08/21 16:52:23 shane Exp $ */
/* #define CRASH_DETECTION */
--- 29,35 ----
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 2.16 1998/08/21 17:16:59 shane Exp $ */
/* #define CRASH_DETECTION */
***************
*** 1555,1560 ****
--- 1555,1561 ----
PHPAPI int php3_sapi_main(struct sapi_request_info *sapi_info, php3_module_entry *module_info)
{
int c;
+ FILE *in = NULL;
#ifdef THREAD_SAFE
flex_globals *php_gbl;
***************
*** 1618,1626 ****
/* if its not cgi, require that we have a filename now */
if (!sapi_info->cgi && !sapi_info->filename) {
! php3_printf("No input file specified.\n");
! php3_request_shutdown((void *) GLOBAL(sapi_rqst) _INLINE_TLS);
! return 0;
}
/*
if sapi_rqst.filename is null and cgi, fopen_for_parser is responsible
--- 1619,1631 ----
/* if its not cgi, require that we have a filename now */
if (!sapi_info->cgi && !sapi_info->filename) {
! if(sapi_info->interactive){
! GLOBAL(phpin)=stdin;
! }else{
! php3_printf("No input file specified.\n");
! php3_request_shutdown((void *) GLOBAL(sapi_rqst) _INLINE_TLS);
! return 0;
! }
}
/*
if sapi_rqst.filename is null and cgi, fopen_for_parser is responsible
***************
*** 1630,1638 ****
#if defined(CRASH_DETECTION)
debug_log("%d:opening file %s\n",GetCurrentThreadId(),sapi_info->filename);
#endif
! GLOBAL(phpin) = php3_fopen_for_parser();
! if (sapi_info->cgi && !GLOBAL(phpin)) {
php3_printf("No input file specified for cgi.\n");
php3_request_shutdown((void *) GLOBAL(sapi_rqst) _INLINE_TLS);
return 0;
--- 1635,1647 ----
#if defined(CRASH_DETECTION)
debug_log("%d:opening file %s\n",GetCurrentThreadId(),sapi_info->filename);
#endif
! if(sapi_info->cgi || sapi_info->filename){
! in = php3_fopen_for_parser();
! } else if (sapi_info->interactive) {
! sapi_info->filename=estrdup("stdin");
! }
! if (sapi_info->cgi && !in) {
php3_printf("No input file specified for cgi.\n");
php3_request_shutdown((void *) GLOBAL(sapi_rqst) _INLINE_TLS);
return 0;
***************
*** 1640,1658 ****
#if defined(CRASH_DETECTION)
debug_log("%d:opening file success\n",GetCurrentThreadId());
#endif
! if (sapi_info->cgi && GLOBAL(phpin)) {
/* #!php support */
! c = fgetc(GLOBAL(phpin));
if (c == '#') {
while (c != 10 && c != 13) {
! c = fgetc(GLOBAL(phpin)); /* skip to end of line */
}
} else {
! rewind(GLOBAL(phpin));
}
}
! if (GLOBAL(phpin)) {
! phprestart(GLOBAL(phpin));
GLOBAL(initialized) |= INIT_SCANNER;
}
if (sapi_info->display_source_mode) {
--- 1649,1667 ----
#if defined(CRASH_DETECTION)
debug_log("%d:opening file success\n",GetCurrentThreadId());
#endif
! if (sapi_info->cgi && in) {
/* #!php support */
! c = fgetc(in);
if (c == '#') {
while (c != 10 && c != 13) {
! c = fgetc(in); /* skip to end of line */
}
} else {
! rewind(in);
}
+ phprestart(in);
}
! if (in) {
GLOBAL(initialized) |= INIT_SCANNER;
}
if (sapi_info->display_source_mode) {
***************
*** 1686,1691 ****
--- 1695,1701 ----
#if defined(CRASH_DETECTION)
debug_log("%d:begin parse\n",GetCurrentThreadId());
#endif
+ if(in)GLOBAL(phpin)=in;
php3_parse(GLOBAL(phpin) _INLINE_TLS);
#if defined(CRASH_DETECTION)
debug_log("%d:parse done\n",GetCurrentThreadId());
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net