/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 2020-2021,2023 Thomas E. Dickey *
* Copyright 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include <curses.priv.h>
-MODULE_ID("$Id: lib_win32util.c,v 1.1 2020/08/14 21:57:01 juergen Exp $")
+MODULE_ID("$Id: lib_win32util.c,v 1.3 2023/02/25 20:07:48 tom Exp $")
#ifdef _NC_WINDOWS
#include <io.h>
/* This function tests, whether or not the ncurses application
is running as a descendant of MSYS2/cygwin mintty terminal
- application. mintty doesn't use Windows Console for it's screen
+ application. mintty doesn't use Windows Console for its screen
I/O, so the native Windows _isatty doesn't recognize it as
character device. But we can discover we are at the end of an
Pipe and can query the server side of the pipe, looking whether
T((T_CALLED("lib_winhelper::_nc_console_checkmintty(%d, %p)"), fd, pMinTTY));
if (handle != INVALID_HANDLE_VALUE) {
- dw = GetFileType(handle);
+ dw = GetFileType(handle);
if (dw == FILE_TYPE_PIPE) {
if (GetNamedPipeInfo(handle, 0, 0, 0, 0)) {
- ULONG pPid;
+ ULONG pPid;
/* Requires NT6 */
if (GetNamedPipeServerProcessId(handle, &pPid)) {
TCHAR buf[MAX_PATH];
/* These security attributes may allow us to
create a remote thread in mintty to manipulate
the terminal state remotely */
- HANDLE pHandle = OpenProcess(
- PROCESS_CREATE_THREAD
+ HANDLE pHandle = OpenProcess(PROCESS_CREATE_THREAD
| PROCESS_QUERY_INFORMATION
| PROCESS_VM_OPERATION
| PROCESS_VM_WRITE
FALSE,
pPid);
if (pMinTTY)
- *pMinTTY = INVALID_HANDLE_VALUE;
+ *pMinTTY = INVALID_HANDLE_VALUE;
if (pHandle != INVALID_HANDLE_VALUE) {
- if ((len = GetProcessImageFileName(
- pHandle,
+ if ((len = GetProcessImageFileName(pHandle,
buf,
(DWORD)
array_length(buf)))) {
TCHAR *pos = _tcsrchr(buf, _T('\\'));
if (pos) {
- pos++;
+ pos++;
if (_tcsnicmp(pos, _TEXT("mintty.exe"), 10)
== 0) {
if (pMinTTY)
- *pMinTTY = pHandle;
+ *pMinTTY = pHandle;
code = 1;
}
}
returnCode(code);
}
#endif /* _NC_CHECK_MINTTY */
-\f
+
+#if HAVE_GETTIMEOFDAY == 2
#define JAN1970 116444736000000000LL /* the value for 01/01/1970 00:00 */
NCURSES_EXPORT(int)
tv->tv_sec = (long) ((data.since1601 - JAN1970) / 10000000LL);
return (0);
}
+#endif // HAVE_GETTIMEOFDAY == 2
#endif // _NC_WINDOWS