Skip to content

Commit cf8738e

Browse files
committed
cleanup arguments and help (patch by Jerome Loyet)
1 parent 040652b commit cf8738e

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

sapi/fpm/fpm/fpm_main.c

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,16 @@ static int php_optind = 1;
145145
static zend_module_entry cgi_module_entry;
146146

147147
static const opt_struct OPTIONS[] = {
148-
{'a', 0, "interactive"},
149-
{'C', 0, "no-chdir"},
150148
{'c', 1, "php-ini"},
151149
{'d', 1, "define"},
152150
{'e', 0, "profile-info"},
153-
{'f', 1, "file"},
154151
{'h', 0, "help"},
155152
{'i', 0, "info"},
156-
{'l', 0, "syntax-check"},
157153
{'m', 0, "modules"},
158154
{'n', 0, "no-php-ini"},
159-
{'q', 0, "no-header"},
160-
{'s', 0, "syntax-highlight"},
161-
{'s', 0, "syntax-highlighting"},
162-
{'w', 0, "strip"},
163155
{'?', 0, "usage"},/* help alias (both '?' and 'usage') */
164156
{'v', 0, "version"},
165157
{'y', 1, "fpm-config"},
166-
{'z', 1, "zend-extension"},
167-
{'T', 1, "timing"},
168158
{'-', 0, NULL} /* end of args */
169159
};
170160

@@ -971,29 +961,18 @@ static void php_cgi_usage(char *argv0)
971961
prog = "php";
972962
}
973963

974-
php_printf( "Usage: %s [-q] [-h] [-s] [-v] [-i] [-f <file>]\n"
975-
" %s <file> [args...]\n"
976-
" -a Run interactively\n"
977-
" -b <address:port>|<port> Bind Path for external FASTCGI Server mode\n"
978-
" -C Do not chdir to the script's directory\n"
964+
php_printf( "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
979965
" -c <path>|<file> Look for php.ini file in this directory\n"
980966
" -n No php.ini file will be used\n"
981967
" -d foo[=bar] Define INI entry foo with value 'bar'\n"
982968
" -e Generate extended information for debugger/profiler\n"
983-
" -f <file> Parse <file>. Implies `-q'\n"
984969
" -h This help\n"
985970
" -i PHP information\n"
986-
" -l Syntax check only (lint)\n"
987971
" -m Show compiled in modules\n"
988-
" -q Quiet-mode. Suppress HTTP Header output.\n"
989-
" -s Display colour syntax highlighted source.\n"
990972
" -v Version number\n"
991-
" -w Display source with stripped comments and whitespace.\n"
992973
" -y, --fpm-config <file>\n"
993-
" Specify alternative path to FastCGI process manager config file.\n"
994-
" -z <file> Load Zend extension <file>.\n"
995-
" -T <count> Measure execution time of script repeated <count> times.\n",
996-
prog, prog);
974+
" Specify alternative path to FastCGI process manager config file.\n",
975+
prog);
997976
}
998977
/* }}} */
999978

@@ -1662,6 +1641,7 @@ int main(int argc, char *argv[])
16621641
exit_status = 0;
16631642
goto out;
16641643

1644+
default:
16651645
case 'h':
16661646
case '?':
16671647
cgi_sapi_module.startup(&cgi_sapi_module);
@@ -1693,6 +1673,19 @@ int main(int argc, char *argv[])
16931673
goto out;
16941674
}
16951675
}
1676+
1677+
/* No other args are permitted here as there is not interactive mode */
1678+
if (argc != php_optind) {
1679+
cgi_sapi_module.startup(&cgi_sapi_module);
1680+
php_output_startup();
1681+
php_output_activate(TSRMLS_C);
1682+
SG(headers_sent) = 1;
1683+
php_cgi_usage(argv[0]);
1684+
php_end_ob_buffers(1 TSRMLS_CC);
1685+
exit_status = 0;
1686+
goto out;
1687+
}
1688+
16961689
php_optind = orig_optind;
16971690
php_optarg = orig_optarg;
16981691

0 commit comments

Comments
 (0)