Klaus Demo nginx / 9d4a8d9
introduce ngx_write_console() to support OEM code pages Igor Sysoev 13 years ago
4 changed file(s) with 24 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
151151
152152 (void) ngx_sprintf(msg, "[%V]: ", &err_levels[level]);
153153
154 (void) ngx_write_fd(ngx_stderr, msg, p - msg);
154 (void) ngx_write_console(ngx_stderr, msg, p - msg);
155155 }
156156
157157
223223
224224 ngx_linefeed(p);
225225
226 (void) ngx_write_fd(ngx_stderr, errstr, p - errstr);
226 (void) ngx_write_console(ngx_stderr, errstr, p - errstr);
227227 }
228228
229229
112112
113113 #define ngx_write_fd_n "write()"
114114
115
116 #define ngx_write_console ngx_write_fd
117
118
115119 #define ngx_linefeed(p) *p++ = LF;
116120 #define NGX_LINEFEED_SIZE 1
117121
231231 }
232232
233233
234 ssize_t
235 ngx_write_console(ngx_fd_t fd, void *buf, size_t size)
236 {
237 u_long n;
238
239 (void) CharToOemBuff(buf, buf, size);
240
241 if (WriteFile(fd, buf, size, &n, NULL) != 0) {
242 return (size_t) n;
243 }
244
245 return -1;
246 }
247
248
234249 ngx_int_t
235250 ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_log_t *log)
236251 {
9797 #define ngx_write_fd_n "WriteFile()"
9898
9999
100 ssize_t ngx_write_console(ngx_fd_t fd, void *buf, size_t size);
101
102
100103 #define ngx_linefeed(p) *p++ = CR; *p++ = LF;
101104 #define NGX_LINEFEED_SIZE 2
102105