Cygwin: pty: add pseudo console support.

- Support pseudo console in PTY. Pseudo console is a new feature
  in Windows 10 1809, which provides console APIs on virtual
  terminal. With this patch, native console applications can work
  in PTYs such as mintty, ssh, gnu screen or tmux.
This commit is contained in:
Takashi Yano
2019-08-28 03:04:02 +09:00
committed by Corinna Vinschen
parent 398476acd2
commit 169d65a577
12 changed files with 2016 additions and 55 deletions

View File

@ -1,12 +1,24 @@
#include <windows.h>
#include <stdio.h>
int
main (int argc, char **argv)
{
char *end;
if (argc != 3)
if (argc < 3)
exit (1);
HANDLE h = (HANDLE) strtoull (argv[1], &end, 0);
SetEvent (h);
if (argc == 4) /* Pseudo console helper mode for PTY */
{
HANDLE hPipe = (HANDLE) strtoull (argv[3], &end, 0);
char buf[64];
sprintf (buf, "StdHandles=%p,%p\n",
GetStdHandle (STD_INPUT_HANDLE),
GetStdHandle (STD_OUTPUT_HANDLE));
DWORD dwLen;
WriteFile (hPipe, buf, strlen (buf), &dwLen, NULL);
CloseHandle (hPipe);
}
h = (HANDLE) strtoull (argv[2], &end, 0);
WaitForSingleObject (h, INFINITE);
exit (0);