mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-30 17:25:09 +02:00
Log UTF-16 characters properly (#500)
This commit is contained in:
parent
904ffd36d4
commit
cd1e7d6f9d
5
log.c
5
log.c
@ -62,7 +62,12 @@ static void *log_handler_ctx;
|
||||
|
||||
extern char *__progname;
|
||||
|
||||
#ifdef WINDOWS
|
||||
#define LOG_SYSLOG_VIS (VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL|VIS_LOG_UTF16)
|
||||
#else
|
||||
#define LOG_SYSLOG_VIS (VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL)
|
||||
#endif
|
||||
|
||||
#define LOG_STDERR_VIS (VIS_SAFE|VIS_OCTAL)
|
||||
|
||||
/* textual representation of log-facilities/levels */
|
||||
|
@ -114,6 +114,16 @@ vis(char *dst, int c, int flag, int nextc)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WINDOWS
|
||||
/*Avoid encoding UTF-16 chatacters so they
|
||||
show up correctly in the logs*/
|
||||
if (flag & VIS_LOG_UTF16) {
|
||||
*dst++ = c;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (((c & 0177) == ' ') || (flag & VIS_OCTAL) ||
|
||||
((flag & VIS_GLOB) && (c == '*' || c == '?' || c == '[' || c == '#'))) {
|
||||
*dst++ = '\\';
|
||||
|
@ -81,6 +81,13 @@
|
||||
*/
|
||||
#define UNVIS_END 1 /* no more characters */
|
||||
|
||||
#ifdef WINDOWS
|
||||
/*
|
||||
* UTF16 logs
|
||||
*/
|
||||
#define VIS_LOG_UTF16 0x800
|
||||
#endif
|
||||
|
||||
char *vis(char *, int, int, int);
|
||||
int strvis(char *, const char *, int);
|
||||
int stravis(char **, const char *, int);
|
||||
|
Loading…
x
Reference in New Issue
Block a user