Skip to content

Commit

Permalink
add macro guard on windows version for VT
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Mar 6, 2024
1 parent 9c7edce commit 5d3f877
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion apps/wolfssh/wolfssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,13 @@ static THREAD_RET readPeer(void* in)
}

/* depend on the terminal to process VT characters */
wrd |= (ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);
#ifndef _WIN32_WINNT_WIN10
/* support for virtual terminal processing was introduced in windows 10 */
#define _WIN32_WINNT_WIN10 0x0A00
#endif
#if defined(WINVER) && (WINVER >= _WIN32_WINNT_WIN10)
wrd |= (ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);
#endif
if (SetConsoleMode(stdoutHandle, wrd) == FALSE) {
err_sys("Unable to set console mode");
}
Expand Down
8 changes: 7 additions & 1 deletion examples/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,13 @@ static THREAD_RET readPeer(void* in)
}

/* depend on the terminal to process VT characters */
wrd |= (ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);
#ifndef _WIN32_WINNT_WIN10
/* support for virtual terminal processing was introduced in windows 10 */
#define _WIN32_WINNT_WIN10 0x0A00
#endif
#if defined(WINVER) && (WINVER >= _WIN32_WINNT_WIN10)
wrd |= (ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);
#endif
if (SetConsoleMode(stdoutHandle, wrd) == FALSE) {
err_sys("Unable to set console mode");
}
Expand Down

0 comments on commit 5d3f877

Please sign in to comment.