wez             Tue Jan 13 22:14:18 2004 EDT

  Added files:                 
    /php-src/sapi/cli   cli_win32.c 

  Modified files:              
    /php-src/sapi/cli   config.w32 php_cli.c 
  Log:
  Add optional php-win.exe variation of the CLI sapi.
  php-win.exe runs in the windows GUI subsystem, and thus
  has no console; stdio handles are effectively set to /dev/null
  and no "dos box" will appear on screen when running scripts
  using this sapi (php-gtk people will be familiar with this concept).
  
  Aside from those differences, php-win.exe is 100% identical to
  regular CLI
  
Index: php-src/sapi/cli/config.w32
diff -u php-src/sapi/cli/config.w32:1.2 php-src/sapi/cli/config.w32:1.3
--- php-src/sapi/cli/config.w32:1.2     Mon Dec 22 08:08:04 2003
+++ php-src/sapi/cli/config.w32 Tue Jan 13 22:14:17 2004
@@ -1,8 +1,9 @@
 // vim:ft=javascript
-// $Id: config.w32,v 1.2 2003/12/22 13:08:04 wez Exp $
+// $Id: config.w32,v 1.3 2004/01/14 03:14:17 wez Exp $
 
 ARG_ENABLE('cli', 'Build CLI version of PHP', 'yes');
 ARG_ENABLE('crt-debug', 'Extra CRT debugging', 'no');
+ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
 
 if (PHP_CLI == "yes") {
        SAPI('cli', 'getopt.c php_cli.c', 'php.exe');
@@ -11,3 +12,7 @@
        }
 }
 
+if (PHP_CLI_WIN32 == "yes") {
+       SAPI('cli_win32', 'getopt.c cli_win32.c', 'php-win.exe');
+}
+
Index: php-src/sapi/cli/php_cli.c
diff -u php-src/sapi/cli/php_cli.c:1.106 php-src/sapi/cli/php_cli.c:1.107
--- php-src/sapi/cli/php_cli.c:1.106    Thu Jan  8 03:18:09 2004
+++ php-src/sapi/cli/php_cli.c  Tue Jan 13 22:14:17 2004
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_cli.c,v 1.106 2004/01/08 08:18:09 andi Exp $ */
+/* $Id: php_cli.c,v 1.107 2004/01/14 03:14:17 wez Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -204,7 +204,11 @@
        {
                ret = sapi_cli_single_write(ptr, remaining);
                if (!ret) {
+#ifdef PHP_CLI_WIN32_NO_CONSOLE
+                       break;
+#else
                        php_handle_aborted_connection();
+#endif
                }
                ptr += ret;
                remaining -= ret;
@@ -217,7 +221,9 @@
 static void sapi_cli_flush(void *server_context)
 {
        if (fflush(stdout)==EOF) {
+#ifndef PHP_CLI_WIN32_NO_CONSOLE
                php_handle_aborted_connection();
+#endif
        }
 }
 
@@ -510,7 +516,11 @@
 
 /* {{{ main
  */
+#ifdef PHP_CLI_WIN32_NO_CONSOLE
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int 
nShowCmd)
+#else
 int main(int argc, char *argv[])
+#endif
 {
        int exit_status = SUCCESS;
        int c;
@@ -536,6 +546,10 @@
        sapi_globals_struct *sapi_globals;
        void ***tsrm_ls;
 #endif
+#ifdef PHP_CLI_WIN32_NO_CONSOLE
+       int argc = __argc;
+       char **argv = __argv;
+#endif
 
 #if defined(PHP_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP)
        {

Index: php-src/sapi/cli/cli_win32.c
+++ php-src/sapi/cli/cli_win32.c
#define PHP_CLI_WIN32_NO_CONSOLE 1
#include "php_cli.c"

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to