cvs: php4 /sapi/cgi cgi_main.c
| From: | Thies C. Arntzen | Date: | Sat, 08 Dec 2001 12:27:02 +0000 |
| Subject: | cvs: php4 /sapi/cgi cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-8518@lists.php.net to get a copy of this message | ||
thies Sat Dec 8 07:27:02 2001 EDT
Modified files:
/php4/sapi/cgi cgi_main.c
Log:
@- Added -w option to the cgi-version. This will remove all comments and
@ whitespace from teh script. (Thies)
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.138 php4/sapi/cgi/cgi_main.c:1.139
--- php4/sapi/cgi/cgi_main.c:1.138 Sun Nov 11 18:11:23 2001
+++ php4/sapi/cgi/cgi_main.c Sat Dec 8 07:27:01 2001
@@ -80,11 +80,12 @@
#define PHP_MODE_HIGHLIGHT 2
#define PHP_MODE_INDENT 3
#define PHP_MODE_LINT 4
+#define PHP_MODE_STRIP 5
extern char *ap_php_optarg;
extern int ap_php_optind;
-#define OPTSTRING "aCc:d:ef:g:hilmnqs?vz:"
+#define OPTSTRING "aCc:d:ef:g:hilmnqsw?vz:"
static int _print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
{
@@ -254,6 +255,7 @@
php_printf("Usage: %s [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file>
[args...]}\n"
" -q Quiet-mode. Suppress HTTP Header output.\n"
" -s Display colour syntax highlighted source.\n"
+ " -w Display source with stripped comments and whitespace.\n"
" -f <file> Parse <file>. Implies `-q'\n"
" -v Version number\n"
" -C Do not chdir to the script's directory\n"
@@ -628,6 +630,10 @@
exit(1);
break;
+ case 'w':
+ behavior=PHP_MODE_STRIP;
+ break;
+
case 'z': /* load extension file */
zend_load_extension(ap_php_optarg);
break;
@@ -754,6 +760,13 @@
} else {
zend_printf("Errors parsing %s\n", file_handle.filename);
}
+ break;
+ case PHP_MODE_STRIP:
+ if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) {
+ zend_strip(TSRMLS_C);
+ fclose(file_handle.handle.fp);
+ }
+ return SUCCESS;
break;
case PHP_MODE_HIGHLIGHT:
{