[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c

2003-05-31 Thread Derick Rethans
derick  Fri May 30 12:10:59 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
/php4/sapi/cli  php_cli.c 
  Log:
  - MFB: Version output beautification
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.229 php4/sapi/cgi/cgi_main.c:1.230
--- php4/sapi/cgi/cgi_main.c:1.229  Mon May 26 19:22:05 2003
+++ php4/sapi/cgi/cgi_main.cFri May 30 12:10:58 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.229 2003/05/26 23:22:05 sniper Exp $ */
+/* $Id: cgi_main.c,v 1.230 2003/05/30 16:10:58 derick Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -1384,7 +1384,11 @@
SG(headers_sent) = 1;
SG(request_info).no_headers = 
1;
}
-   php_printf("PHP %s (%s), Copyright (c) 
1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+#if ZEND_DEBUG
+   php_printf("PHP %s (%s) (built: %s %s) 
(DEBUG)\nCopyright (c) 1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, 
__DATE__, __TIME__, get_zend_version());
+#else
+   php_printf("PHP %s (%s) (built: %s 
%s)\nCopyright (c) 1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, 
__DATE__, __TIME__, get_zend_version());
+#endif
php_end_ob_buffers(1 TSRMLS_CC);
exit(1);
break;
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.92 php4/sapi/cli/php_cli.c:1.93
--- php4/sapi/cli/php_cli.c:1.92Thu May 29 20:11:37 2003
+++ php4/sapi/cli/php_cli.c Fri May 30 12:10:58 2003
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: php_cli.c,v 1.92 2003/05/30 00:11:37 helly Exp $ */
+/* $Id: php_cli.c,v 1.93 2003/05/30 16:10:58 derick Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -651,7 +651,11 @@
if (php_request_startup(TSRMLS_C)==FAILURE) {
goto err;
}
+#if ZEND_DEBUG
+   php_printf("PHP %s (%s) (built: %s %s) 
(DEBUG)\nCopyright (c) 1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, 
__DATE__, __TIME__, get_zend_version());
+#else
php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 
1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, 
get_zend_version());
+#endif
php_end_ob_buffers(1 TSRMLS_CC);
exit_status=1;
goto out;



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



[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c

2003-01-07 Thread Ilia Alshanetsky
iliaa   Tue Jan  7 19:41:53 2003 EDT

  Modified files:  
/php4/sapi/cli  php_cli.c 
/php4/sapi/cgi  cgi_main.c 
  Log:
  Fixed bug #21297. The fix also fixes miscalculation of lines numbers by 1
  due the previously mentioned bug.
  
  
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.60 php4/sapi/cli/php_cli.c:1.61
--- php4/sapi/cli/php_cli.c:1.60Sun Jan  5 11:10:35 2003
+++ php4/sapi/cli/php_cli.c Tue Jan  7 19:41:53 2003
@@ -695,6 +695,13 @@
while (c != 10 && c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
+   /* handle situations where line is terminated by \r\n 
+*/
+   if (c == 13) {
+   if (fgetc(file_handle.handle.fp) != 10) {
+   long pos = 
+ftell(file_handle.handle.fp);
+   fseek(file_handle.handle.fp, pos - 1, 
+SEEK_SET);
+   }
+   }
CG(start_lineno) = 2;
} else {
rewind(file_handle.handle.fp);
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.206 php4/sapi/cgi/cgi_main.c:1.207
--- php4/sapi/cgi/cgi_main.c:1.206  Tue Jan  7 11:33:28 2003
+++ php4/sapi/cgi/cgi_main.cTue Jan  7 19:41:53 2003
@@ -1413,6 +1413,13 @@
while (c != 10 && c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
+   /* handle situations where line is terminated by \r\n 
+*/
+   if (c == 13) {
+   if (fgetc(file_handle.handle.fp) != 10) {
+   long pos = 
+ftell(file_handle.handle.fp);
+   fseek(file_handle.handle.fp, pos - 1, 
+SEEK_SET);
+   }
+   }
CG(start_lineno) = 2;
} else {
rewind(file_handle.handle.fp);



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




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c

2003-01-05 Thread Zeev Suraski
zeevSun Jan  5 11:10:36 2003 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
/php4/sapi/cli  php_cli.c 
  Log:
  Initialize lineno using the new infrastructure
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.204 php4/sapi/cgi/cgi_main.c:1.205
--- php4/sapi/cgi/cgi_main.c:1.204  Tue Dec 31 10:59:05 2002
+++ php4/sapi/cgi/cgi_main.cSun Jan  5 11:10:34 2003
@@ -1413,7 +1413,7 @@
while (c != 10 && c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
-   CG(zend_lineno) = -2;
+   CG(start_lineno) = 2;
} else {
rewind(file_handle.handle.fp);
}
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.59 php4/sapi/cli/php_cli.c:1.60
--- php4/sapi/cli/php_cli.c:1.59Tue Dec 31 10:59:06 2002
+++ php4/sapi/cli/php_cli.c Sun Jan  5 11:10:35 2003
@@ -695,7 +695,7 @@
while (c != 10 && c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
-   CG(zend_lineno) = -2;
+   CG(start_lineno) = 2;
} else {
rewind(file_handle.handle.fp);
}



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




[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c

2002-11-14 Thread Andrei Zmievski
andrei  Thu Nov 14 15:32:29 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
/php4/sapi/cli  php_cli.c 
  Log:
  Sort the modules and extensions before printing them when -m switch is used.
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.190 php4/sapi/cgi/cgi_main.c:1.191
--- php4/sapi/cgi/cgi_main.c:1.190  Tue Nov 12 15:56:46 2002
+++ php4/sapi/cgi/cgi_main.cThu Nov 14 15:32:26 2002
@@ -117,18 +117,59 @@
 
 #define OPTSTRING "aCc:d:ef:g:hilmnqsw?vz:"
 
-static int _print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
+static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
 {
php_printf("%s\n", module->name);
return 0;
 }
 
-static int _print_extension_info(zend_extension *module, void *arg TSRMLS_DC)
+static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
 {
-   php_printf("%s\n", module->name);
+   Bucket *f = *((Bucket **) a);
+   Bucket *s = *((Bucket **) b);
+
+   return strcmp(((zend_module_entry *)f->pData)->name,
+ ((zend_module_entry *)s->pData)->name);
+}
+
+static void print_modules(TSRMLS_D)
+{
+   HashTable sorted_registry;
+   zend_module_entry tmp;
+
+   zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
+   zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, 
+sizeof(zend_module_entry));
+   zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
+   zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) 
+print_module_info, NULL TSRMLS_CC);
+   zend_hash_destroy(&sorted_registry);
+}
+
+static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC)
+{
+   php_printf("%s\n", ext->name);
return 0;
 }
 
+static int extension_name_cmp(const zend_llist_element *a,
+ const zend_llist_element *b 
+TSRMLS_DC)
+{
+   zend_llist_element *f = *((zend_llist_element **)a);
+   zend_llist_element *s = *((zend_llist_element **)b);
+
+   return strcmp(((zend_extension *)f->data)->name,
+ ((zend_extension *)s->data)->name);
+}
+
+static void print_extensions(TSRMLS_D)
+{
+   zend_llist sorted_exts;
+
+   zend_llist_copy(&sorted_exts, &zend_extensions);
+   zend_llist_sort(&sorted_exts, extension_name_cmp TSRMLS_CC);
+   zend_llist_apply_with_argument(&sorted_exts, (llist_apply_with_arg_func_t) 
+print_extension_info, NULL TSRMLS_CC);
+   zend_llist_destroy(&sorted_exts);
+}
+
 #ifndef STDOUT_FILENO
 #define STDOUT_FILENO 1
 #endif
@@ -966,9 +1007,9 @@
php_output_activate(TSRMLS_C);
SG(headers_sent) = 1;
php_printf("[PHP Modules]\n");
-   
zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) _print_module_info, 
NULL TSRMLS_CC);
+   print_modules(TSRMLS_C);
php_printf("\n[Zend Modules]\n");
-   
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) 
_print_extension_info, NULL TSRMLS_CC);
+   print_extensions(TSRMLS_C);
php_printf("\n");
php_end_ob_buffers(1 TSRMLS_CC);
exit(1);
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.51 php4/sapi/cli/php_cli.c:1.52
--- php4/sapi/cli/php_cli.c:1.51Wed Nov 13 07:41:05 2002
+++ php4/sapi/cli/php_cli.c Thu Nov 14 15:32:28 2002
@@ -87,18 +87,56 @@
 
 #define OPTSTRING "aCc:d:ef:g:hilmnqr:sw?vz:"
 
-static int _print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
+static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
 {
php_printf("%s\n", module->name);
return 0;
 }
 
-static int _print_extension_info(zend_extension *module, void *arg TSRMLS_DC)
+static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
 {
-   php_printf("%s\n", module->name);
+   Bucket *f = *((Bucket **) a);
+   Bucket *s = *((Bucket **) b);
+
+   return strcmp(((zend_module_entry *)f->pData)->name,
+ ((zend_module_entry *)s->pData)->name);
+}
+
+static void print_modules(TSRMLS_D)
+{
+   HashTable sorted_registry;
+   zend_module_entry tmp;
+
+   zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
+   zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, 
+sizeof(zend_module_entry));
+   zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
+   zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) 
+print_module_info, NULL TSRMLS_CC);
+   zend

[PHP-CVS] cvs: php4 /sapi/cgi cgi_main.c /sapi/cli php_cli.c /sapi/fastcgi fastcgi.c

2002-11-05 Thread Ilia Alshanetsky
iliaa   Tue Nov  5 17:04:14 2002 EDT

  Modified files:  
/php4/sapi/cgi  cgi_main.c 
/php4/sapi/cli  php_cli.c 
/php4/sapi/fastcgi  fastcgi.c 
  Log:
  Fixed bug #20035. ZE now allows us to pass the current line position by 
  setting zend_lineno to (current_line * -1).
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.186 php4/sapi/cgi/cgi_main.c:1.187
--- php4/sapi/cgi/cgi_main.c:1.186  Fri Oct 25 10:33:46 2002
+++ php4/sapi/cgi/cgi_main.cTue Nov  5 17:04:10 2002
@@ -1119,7 +1119,7 @@
while (c != 10 && c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
-   CG(zend_lineno)++;
+   CG(zend_lineno) = -2;
} else {
rewind(file_handle.handle.fp);
}
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.48 php4/sapi/cli/php_cli.c:1.49
--- php4/sapi/cli/php_cli.c:1.48Tue Nov  5 10:15:51 2002
+++ php4/sapi/cli/php_cli.c Tue Nov  5 17:04:12 2002
@@ -652,7 +652,7 @@
while (c != 10 && c != 13) {
c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
}
-   CG(zend_lineno)++;
+   CG(zend_lineno) = -2;
} else {
rewind(file_handle.handle.fp);
}
Index: php4/sapi/fastcgi/fastcgi.c
diff -u php4/sapi/fastcgi/fastcgi.c:1.26 php4/sapi/fastcgi/fastcgi.c:1.27
--- php4/sapi/fastcgi/fastcgi.c:1.26Wed Sep 18 17:57:33 2002
+++ php4/sapi/fastcgi/fastcgi.c Tue Nov  5 17:04:12 2002
@@ -237,7 +237,7 @@
while (c != 10 && c != 13) {
c = fgetc(file_handle.handle.fp);   /* skip to end 
of line */
}
-   CG(zend_lineno)++;
+   CG(zend_lineno) = -2;
} else {
rewind(file_handle.handle.fp);
}



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