mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
introduce ngx_write_console() to support OEM code pages
This commit is contained in:
parent
bffd3196cf
commit
9d4a8d9111
@ -152,7 +152,7 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
|
||||
|
||||
(void) ngx_sprintf(msg, "[%V]: ", &err_levels[level]);
|
||||
|
||||
(void) ngx_write_fd(ngx_stderr, msg, p - msg);
|
||||
(void) ngx_write_console(ngx_stderr, msg, p - msg);
|
||||
}
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ ngx_log_stderr(ngx_err_t err, const char *fmt, ...)
|
||||
|
||||
ngx_linefeed(p);
|
||||
|
||||
(void) ngx_write_fd(ngx_stderr, errstr, p - errstr);
|
||||
(void) ngx_write_console(ngx_stderr, errstr, p - errstr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,6 +113,10 @@ ngx_write_fd(ngx_fd_t fd, void *buf, size_t n)
|
||||
|
||||
#define ngx_write_fd_n "write()"
|
||||
|
||||
|
||||
#define ngx_write_console ngx_write_fd
|
||||
|
||||
|
||||
#define ngx_linefeed(p) *p++ = LF;
|
||||
#define NGX_LINEFEED_SIZE 1
|
||||
|
||||
|
@ -232,6 +232,21 @@ ngx_write_fd(ngx_fd_t fd, void *buf, size_t size)
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ngx_write_console(ngx_fd_t fd, void *buf, size_t size)
|
||||
{
|
||||
u_long n;
|
||||
|
||||
(void) CharToOemBuff(buf, buf, size);
|
||||
|
||||
if (WriteFile(fd, buf, size, &n, NULL) != 0) {
|
||||
return (size_t) n;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_log_t *log)
|
||||
{
|
||||
|
@ -98,6 +98,9 @@ ssize_t ngx_write_fd(ngx_fd_t fd, void *buf, size_t size);
|
||||
#define ngx_write_fd_n "WriteFile()"
|
||||
|
||||
|
||||
ssize_t ngx_write_console(ngx_fd_t fd, void *buf, size_t size);
|
||||
|
||||
|
||||
#define ngx_linefeed(p) *p++ = CR; *p++ = LF;
|
||||
#define NGX_LINEFEED_SIZE 2
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user