aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-04-21 16:21:58 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-04-21 16:21:58 +0000
commit59c393f3933a69bc95739c0b363993c7b802947c (patch)
tree868f19c16f0783efd7ec3e166325cf50387f10d2
parente980a6814bcc547f9435634f27856b48c70c9e26 (diff)
downloadnginx-59c393f3933a69bc95739c0b363993c7b802947c.tar.gz
nginx-59c393f3933a69bc95739c0b363993c7b802947c.zip
add -? and -h options
-rw-r--r--src/core/nginx.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 3c6aab8cb..566f8f977 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -183,6 +183,7 @@ ngx_module_t ngx_core_module = {
ngx_uint_t ngx_max_module;
+static ngx_uint_t ngx_show_help;
static ngx_uint_t ngx_show_version;
static ngx_uint_t ngx_show_configure;
static u_char *ngx_conf_file;
@@ -210,6 +211,29 @@ main(int argc, char *const *argv)
if (ngx_show_version) {
ngx_log_stderr("nginx version: " NGINX_VER);
+ if (ngx_show_help) {
+ ngx_log_stderr(
+ "Usage: nginx [-?hvVt]"
+#if (NGX_WIN32)
+ " [-s signal]"
+#endif
+ " [-c filename] [-g directives]" CRLF CRLF
+ "Options:" CRLF
+ " -?,-h : this help" CRLF
+ " -v : show version and exit" CRLF
+ " -V : show version and configure options then exit"
+ CRLF
+ " -t : test configuration and exit" CRLF
+#if (NGX_WIN32)
+ " -s signal : send signal to a master process" CRLF
+#endif
+ " -c filename : set configuration file (default: "
+ NGX_CONF_PATH ")" CRLF
+ " -g directives : set global directives out of configuration "
+ "file" CRLF
+ );
+ }
+
if (ngx_show_configure) {
#ifdef NGX_COMPILER
ngx_log_stderr("built by " NGX_COMPILER);
@@ -614,6 +638,12 @@ ngx_get_options(int argc, char *const *argv)
switch (*p++) {
+ case '?':
+ case 'h':
+ ngx_show_version = 1;
+ ngx_show_help = 1;
+ break;
+
case 'v':
ngx_show_version = 1;
break;