]> sourceware.org Git - newlib-cygwin.git/blob - winsup/utils/cygwin-console-helper.cc
Cygwin: pty: Prevent the helper process from exiting by Ctrl-C.
[newlib-cygwin.git] / winsup / utils / cygwin-console-helper.cc
1 #include <windows.h>
2 #include <stdio.h>
3 int
4 main (int argc, char **argv)
5 {
6 char *end;
7 if (argc < 3)
8 exit (1);
9 HANDLE h = (HANDLE) strtoull (argv[1], &end, 0);
10 SetEvent (h);
11 if (argc == 4) /* Pseudo console helper mode for PTY */
12 {
13 SetConsoleCtrlHandler (NULL, TRUE);
14 HANDLE hPipe = (HANDLE) strtoull (argv[3], &end, 0);
15 char buf[64];
16 sprintf (buf, "StdHandles=%p,%p\n",
17 GetStdHandle (STD_INPUT_HANDLE),
18 GetStdHandle (STD_OUTPUT_HANDLE));
19 DWORD dwLen;
20 WriteFile (hPipe, buf, strlen (buf), &dwLen, NULL);
21 CloseHandle (hPipe);
22 }
23 h = (HANDLE) strtoull (argv[2], &end, 0);
24 WaitForSingleObject (h, INFINITE);
25 exit (0);
26 }
This page took 0.039535 seconds and 6 git commands to generate.