changeset 2735:a9d7f8ebdbef

add -? and -h options
author Igor Sysoev <igor@sysoev.ru>
date Tue, 21 Apr 2009 16:21:58 +0000
parents 37580bd13ca5
children 218b8949f2fd
files src/core/nginx.c
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 *a
 
             switch (*p++) {
 
+            case '?':
+            case 'h':
+                ngx_show_version = 1;
+                ngx_show_help = 1;
+                break;
+
             case 'v':
                 ngx_show_version = 1;
                 break;