[nginx] svn commit: r4361 - in branches/stable-1.0: . src/core src/os/unix src/os/win32

mdounin at mdounin.ru mdounin at mdounin.ru
Wed Dec 14 15:23:23 UTC 2011


Author: mdounin
Date: 2011-12-14 15:23:23 +0000 (Wed, 14 Dec 2011)
New Revision: 4361

Log:
Merge of r4284:

Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
for output of ./configure options, etc., since ngx_log_stderr() output
length is limited by 2048 characters defined as NGX_MAX_ERROR_STR.


Modified:
   branches/stable-1.0/
   branches/stable-1.0/src/core/nginx.c
   branches/stable-1.0/src/core/ngx_log.h
   branches/stable-1.0/src/os/unix/ngx_files.h
   branches/stable-1.0/src/os/win32/ngx_files.h


Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4283,4300-4304,4308-4309,4321,4342-4343
   + /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4300-4304,4308-4309,4321,4342-4343

Modified: branches/stable-1.0/src/core/nginx.c
===================================================================
--- branches/stable-1.0/src/core/nginx.c	2011-12-14 15:16:05 UTC (rev 4360)
+++ branches/stable-1.0/src/core/nginx.c	2011-12-14 15:23:23 UTC (rev 4361)
@@ -216,47 +216,49 @@
     }
 
     if (ngx_show_version) {
-        ngx_log_stderr(0, "nginx version: " NGINX_VER);
+        ngx_write_stderr("nginx version: " NGINX_VER NGX_LINEFEED);
 
         if (ngx_show_help) {
-            ngx_log_stderr(0,
+            ngx_write_stderr(
                 "Usage: nginx [-?hvVtq] [-s signal] [-c filename] "
-                             "[-p prefix] [-g directives]" CRLF CRLF
-                "Options:" CRLF
-                "  -?,-h         : this help" CRLF
-                "  -v            : show version and exit" CRLF
+                             "[-p prefix] [-g directives]" NGX_LINEFEED
+                             NGX_LINEFEED
+                "Options:" NGX_LINEFEED
+                "  -?,-h         : this help" NGX_LINEFEED
+                "  -v            : show version and exit" NGX_LINEFEED
                 "  -V            : show version and configure options then exit"
-                                   CRLF
-                "  -t            : test configuration and exit" CRLF
+                                   NGX_LINEFEED
+                "  -t            : test configuration and exit" NGX_LINEFEED
                 "  -q            : suppress non-error messages "
-                                   "during configuration testing" CRLF
+                                   "during configuration testing" NGX_LINEFEED
                 "  -s signal     : send signal to a master process: "
-                                   "stop, quit, reopen, reload" CRLF
+                                   "stop, quit, reopen, reload" NGX_LINEFEED
 #ifdef NGX_PREFIX
                 "  -p prefix     : set prefix path (default: "
-                                   NGX_PREFIX ")" CRLF
+                                   NGX_PREFIX ")" NGX_LINEFEED
 #else
-                "  -p prefix     : set prefix path (default: NONE)" CRLF
+                "  -p prefix     : set prefix path (default: NONE)" NGX_LINEFEED
 #endif
                 "  -c filename   : set configuration file (default: "
-                                   NGX_CONF_PATH ")" CRLF
+                                   NGX_CONF_PATH ")" NGX_LINEFEED
                 "  -g directives : set global directives out of configuration "
-                                   "file" CRLF
+                                   "file" NGX_LINEFEED NGX_LINEFEED
                 );
         }
 
         if (ngx_show_configure) {
+            ngx_write_stderr(
 #ifdef NGX_COMPILER
-            ngx_log_stderr(0, "built by " NGX_COMPILER);
+                "built by " NGX_COMPILER NGX_LINEFEED
 #endif
 #if (NGX_SSL)
 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
-            ngx_log_stderr(0, "TLS SNI support enabled");
+                "TLS SNI support enabled" NGX_LINEFEED
 #else
-            ngx_log_stderr(0, "TLS SNI support disabled");
+                "TLS SNI support disabled" NGX_LINEFEED
 #endif
 #endif
-            ngx_log_stderr(0, "configure arguments:" NGX_CONFIGURE);
+                "configure arguments:" NGX_CONFIGURE NGX_LINEFEED);
         }
 
         if (!ngx_test_config) {

Modified: branches/stable-1.0/src/core/ngx_log.h
===================================================================
--- branches/stable-1.0/src/core/ngx_log.h	2011-12-14 15:16:05 UTC (rev 4360)
+++ branches/stable-1.0/src/core/ngx_log.h	2011-12-14 15:23:23 UTC (rev 4361)
@@ -203,6 +203,22 @@
 u_char *ngx_log_errno(u_char *buf, u_char *last, ngx_err_t err);
 
 
+/*
+ * ngx_write_stderr() cannot be implemented as macro, since
+ * MSVC does not allow to use #ifdef inside macro parameters.
+ *
+ * ngx_write_fd() is used instead of ngx_write_console(), since
+ * CharToOemBuff() inside ngx_write_console() cannot be used with
+ * read only buffer as destination and CharToOemBuff() is not needed
+ * for ngx_write_stderr() anyway.
+ */
+static ngx_inline void
+ngx_write_stderr(char *text)
+{
+    (void) ngx_write_fd(ngx_stderr, text, strlen(text));
+}
+
+
 extern ngx_module_t  ngx_errlog_module;
 extern ngx_uint_t    ngx_use_stderr;
 

Modified: branches/stable-1.0/src/os/unix/ngx_files.h
===================================================================
--- branches/stable-1.0/src/os/unix/ngx_files.h	2011-12-14 15:16:05 UTC (rev 4360)
+++ branches/stable-1.0/src/os/unix/ngx_files.h	2011-12-14 15:23:23 UTC (rev 4361)
@@ -128,6 +128,7 @@
 
 #define ngx_linefeed(p)          *p++ = LF;
 #define NGX_LINEFEED_SIZE        1
+#define NGX_LINEFEED             "\x0a"
 
 
 #define ngx_rename_file(o, n)    rename((const char *) o, (const char *) n)

Modified: branches/stable-1.0/src/os/win32/ngx_files.h
===================================================================
--- branches/stable-1.0/src/os/win32/ngx_files.h	2011-12-14 15:16:05 UTC (rev 4360)
+++ branches/stable-1.0/src/os/win32/ngx_files.h	2011-12-14 15:23:23 UTC (rev 4361)
@@ -115,6 +115,7 @@
 
 #define ngx_linefeed(p)             *p++ = CR; *p++ = LF;
 #define NGX_LINEFEED_SIZE           2
+#define NGX_LINEFEED                CRLF
 
 
 #define ngx_delete_file(name)       DeleteFile((const char *) name)



More information about the nginx-devel mailing list