cvs: /php3 ChangeLog control_structures_inline.h /php3/functions datetime.c exec.c file.c parsedate.y /php3/win32 php3.dsp php_custom_build.dsp
| From: | Jim Winstead | Date: | Fri, 16 Jul 1999 14:05:02 +0000 |
| Subject: | cvs: /php3 ChangeLog control_structures_inline.h /php3/functions datetime.c exec.c file.c parsedate.y /php3/win32 php3.dsp php_custom_build.dsp | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8595@lists.php.net to get a copy of this message | ||
jim Fri Jul 16 14:05:02 1999 EDT
Modified files:
/php3 ChangeLog control_structures_inline.h
/php3/functions datetime.c exec.c file.c parsedate.y
/php3/win32 php3.dsp php_custom_build.dsp
Log:
Fix exec/popen/system under IIS.
Make parsedate stuff compile on Windows.
Fix popen/pclose being misnamed on Windows.
Index: php3/ChangeLog
diff -u php3/ChangeLog:1.726 php3/ChangeLog:1.727
--- php3/ChangeLog:1.726 Wed Jul 14 14:42:03 1999
+++ php3/ChangeLog Fri Jul 16 14:04:58 1999
@@ -2,6 +2,8 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
??, Version 3.0.12
+- Fixed popen and pclose functions on Windows. (Jim)
+- Fixed subprocess creation on Windows when used with IIS (Jim, Dave Cramer)
- Support for Swatch(r) Beat(tm), also known as Internet Time.
Use by including "B" in the date() or gmdate() format string. (markonen)
- added gmstrftime() (like strftime() but prints out in GMT not local
Index: php3/control_structures_inline.h
diff -u php3/control_structures_inline.h:1.199 php3/control_structures_inline.h:1.200
--- php3/control_structures_inline.h:1.199 Fri Jul 2 12:41:50 1999
+++ php3/control_structures_inline.h Fri Jul 16 14:04:59 1999
@@ -29,7 +29,7 @@
*/
-/* $Id: control_structures_inline.h,v 1.199 1999/07/02 16:41:50 markonen Exp $ */
+/* $Id: control_structures_inline.h,v 1.200 1999/07/16 18:04:59 jim Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
@@ -1421,6 +1421,7 @@
convert_to_string(expr);
#if WIN32|WINNT
+ (void)AllocConsole();
if ((in=popen(expr->value.str.val,"rt"))==NULL) {
#else
if ((in=popen(expr->value.str.val,"r"))==NULL) {
Index: php3/functions/datetime.c
diff -u php3/functions/datetime.c:1.69 php3/functions/datetime.c:1.70
--- php3/functions/datetime.c:1.69 Wed Jul 14 14:42:03 1999
+++ php3/functions/datetime.c Fri Jul 16 14:05:00 1999
@@ -30,7 +30,7 @@
*/
-/* $Id: datetime.c,v 1.69 1999/07/14 18:42:03 markonen Exp $ */
+/* $Id: datetime.c,v 1.70 1999/07/16 18:05:00 jim Exp $ */
#ifdef THREAD_SAFE
@@ -44,7 +44,10 @@
#include <time.h>
#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
+# include <sys/time.h>
+#endif
+#ifdef WIN32
+# include "win32/time.h"
#endif
#include <stdio.h>
Index: php3/functions/exec.c
diff -u php3/functions/exec.c:1.83 php3/functions/exec.c:1.84
--- php3/functions/exec.c:1.83 Wed Jun 16 07:34:18 1999
+++ php3/functions/exec.c Fri Jul 16 14:05:00 1999
@@ -26,7 +26,7 @@
| Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.83 1999/06/16 11:34:18 ssb Exp $ */
+/* $Id: exec.c,v 1.84 1999/07/16 18:05:00 jim Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
@@ -59,6 +59,10 @@
int overflow_limit, lcmd, ldir;
char *b, *c, *d=NULL;
TLS_VARS;
+
+#ifdef WIN32
+ (void)AllocConsole(); /* We don't care if this fails. */
+#endif
if (php3_ini.safe_mode) {
lcmd = strlen(cmd);
Index: php3/functions/file.c
diff -u php3/functions/file.c:1.222 php3/functions/file.c:1.223
--- php3/functions/file.c:1.222 Sat Jul 10 16:51:17 1999
+++ php3/functions/file.c Fri Jul 16 14:05:00 1999
@@ -26,7 +26,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.222 1999/07/10 20:51:17 sas Exp $ */
+/* $Id: file.c,v 1.223 1999/07/16 18:05:00 jim Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
@@ -185,8 +185,6 @@
#endif
function_entry php3_file_functions[] = {
- PHP_FE(pclose, NULL)
- PHP_FE(popen, NULL)
PHP_FE(readfile, NULL)
PHP_FE(rewind, NULL)
{"umask", php3_fileumask, NULL},
@@ -216,6 +214,9 @@
#if (0 && defined(HAVE_SYS_TIME_H) && HAVE_SETSOCKOPT &&
defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO))
PHP_FE(set_socket_timeout, NULL)
#endif
+ /* Can't use the PHP_FE() macro here because of #defines on Windows. */
+ {"pclose", php3_pclose, NULL},
+ {"popen", php3_popen, NULL},
{NULL, NULL, NULL}
};
@@ -413,7 +414,7 @@
static void __pclose(FILE *pipe)
{
-TLS_VARS;
+ TLS_VARS;
GLOBAL(pclose_ret) = pclose(pipe);
}
@@ -555,7 +556,7 @@
/* {{{ proto int popen(string command, string mode)
Execute a command and open either a read or a write pipe to it */
-void php3_popen(INTERNAL_FUNCTION_PARAMETERS) {
+PHP_FUNCTION(popen) {
pval *arg1, *arg2;
FILE *fp;
int id;
@@ -570,34 +571,33 @@
convert_to_string(arg2);
p = estrndup(arg2->value.str.val,arg2->value.str.len);
if (php3_ini.safe_mode){
- b = strchr(arg1->value.str.val,' ');
- if (!b) {
- b = strrchr(arg1->value.str.val,'/');
- } else {
- char *c;
- c = arg1->value.str.val;
- while((*b!='/')&&(b!=c)) b--;
- if (b==c) b=NULL;
- }
- if (b) {
- snprintf(buf,sizeof(buf),"%s%s",php3_ini.safe_mode_exec_dir,b);
- } else {
- snprintf(buf,sizeof(buf),"%s/%s",php3_ini.safe_mode_exec_dir,arg1->value.str.val);
- }
- fp = popen(buf,p);
- if (!fp) {
- php3_error(E_WARNING,"popen(\"%s\",\"%s\") -
%s",buf,p,strerror(errno));
- RETURN_FALSE;
- }
+ b = strchr(arg1->value.str.val,' ');
+ if (!b) {
+ b = strrchr(arg1->value.str.val,'/');
+ } else {
+ char *c;
+ c = arg1->value.str.val;
+ while((*b!='/')&&(b!=c)) b--;
+ if (b==c) b=NULL;
+ }
+ if (b) {
+ snprintf(buf,sizeof(buf),"%s%s",php3_ini.safe_mode_exec_dir,b);
+ } else {
+ snprintf(buf,sizeof(buf),"%s/%s",php3_ini.safe_mode_exec_dir,arg1->value.str.val);
+ }
+ fp = popen(buf,p);
+ if (!fp) {
+ php3_error(E_WARNING,"popen(\"%s\",\"%s\") -
%s",buf,p,strerror(errno));
+ RETURN_FALSE;
+ }
} else {
- fp = popen(arg1->value.str.val,p);
- if (!fp) {
- php3_error(E_WARNING,"popen(\"%s\",\"%s\") -
%s",arg1->value.str.val,p,strerror(errno));
- efree(p);
- RETURN_FALSE;
- }
+ fp = popen(arg1->value.str.val,p);
+ if (!fp) {
+ php3_error(E_WARNING,"popen(\"%s\",\"%s\") -
%s",arg1->value.str.val,p,strerror(errno));
+ efree(p);
+ RETURN_FALSE;
+ }
}
-/* #endif */
id = php3_list_insert(fp,GLOBAL(le_pp));
efree(p);
RETURN_LONG(id);
Index: php3/functions/parsedate.y
diff -u php3/functions/parsedate.y:1.8 php3/functions/parsedate.y:1.9
--- php3/functions/parsedate.y:1.8 Tue Jul 13 20:25:35 1999
+++ php3/functions/parsedate.y Fri Jul 16 14:05:01 1999
@@ -1,5 +1,5 @@
%{
-/* $Revision: 1.8 $
+/* $Revision: 1.9 $
**
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
@@ -18,13 +18,23 @@
/* SUPPRESS 593 on yynewstate *//* Label was not used */
/* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */
-#include "config.h"
+#ifdef WIN32
+# include "config.w32.h"
+#else
+# include "config.h"
+#endif
+
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
+
#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
+# include <sys/time.h>
#endif
+#ifdef WIN32
+# include "win32/time.h"
+#endif
+
#include <ctype.h>
#if defined(_HPUX_SOURCE)
Index: php3/win32/php3.dsp
diff -u php3/win32/php3.dsp:1.1 php3/win32/php3.dsp:1.2
--- php3/win32/php3.dsp:1.1 Mon Jun 28 17:43:31 1999
+++ php3/win32/php3.dsp Fri Jul 16 14:05:01 1999
@@ -332,6 +332,14 @@
# End Source File
# Begin Source File
+SOURCE=..\functions\parsedate.tab.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\functions\parsedate.tab.h
+# End Source File
+# Begin Source File
+
SOURCE=..\functions\php3_bcmath.h
# End Source File
# Begin Source File
Index: php3/win32/php_custom_build.dsp
diff -u php3/win32/php_custom_build.dsp:1.2 php3/win32/php_custom_build.dsp:1.3
--- php3/win32/php_custom_build.dsp:1.2 Mon Jun 28 19:48:06 1999
+++ php3/win32/php_custom_build.dsp Fri Jul 16 14:05:01 1999
@@ -149,10 +149,16 @@
# Begin Custom Build - Build Language Bison Parser
InputPath="..\language-parser.y"
-"..\language-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set BISON_SIMPLE=bin\bison.simple
- bin\bison -v -d -p php ../language-parser.y -o ../language-parser.tab.c
+BuildCmds= \
+ set BISON_SIMPLE=bin\bison.simple \
+ bin\bison -v -d -p php ../language-parser.y -o ../language-parser.tab.c \
+
+"..\language-parser.tab.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"..\language-parser.tab.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "php_custom_build - Win32 Debug"
@@ -201,6 +207,47 @@
"..\language-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
bin\flex -Pphp -o../language-scanner.c -i ../language-scanner.lex
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\functions\parsedate.y
+
+!IF "$(CFG)" == "php_custom_build - Win32 Release"
+
+# Begin Custom Build
+InputPath=..\functions\parsedate.y
+
+BuildCmds= \
+ set BISON_SIMPLE=bin\bison.simple \
+ bin\bison -v -d ../functions/parsedate.y -o ../functions/parsedate.tab.c \
+
+
+"../functions/parsedate.tab.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"../functions/parsedate.tab.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php_custom_build - Win32 Debug"
+
+# Begin Custom Build
+InputPath=..\functions\parsedate.y
+
+BuildCmds= \
+ set BISON_SIMPLE=bin\bison.simple \
+ bin\bison -v -d ../functions/parsedate.y -o ../functions/parsedate.tab.c \
+
+
+"../functions/parsedate.tab.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"../functions/parsedate.tab.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
# End Custom Build
!ENDIF