зеркало из https://github.com/github/putty.git
New Windows utility function: is_console_handle().
Rather like isatty() on Unix, this tells you if a raw Windows HANDLE points at a console or not. Useful to know if your standard output or standard error is going to be shown to a user, or redirected to something that will make automated use of it.
This commit is contained in:
Родитель
bc1aa9c656
Коммит
f9b1a2bbc2
|
@ -267,3 +267,11 @@ bool platform_sha1_hw_available(void)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool is_console_handle(HANDLE handle)
|
||||
{
|
||||
DWORD ignored_output;
|
||||
if (GetConsoleMode(handle, &ignored_output))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -569,6 +569,8 @@ GLOBAL bool restricted_acl;
|
|||
void escape_registry_key(const char *in, strbuf *out);
|
||||
void unescape_registry_key(const char *in, strbuf *out);
|
||||
|
||||
bool is_console_handle(HANDLE);
|
||||
|
||||
/* A few pieces of up-to-date Windows API definition needed for older
|
||||
* compilers. */
|
||||
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
|
||||
|
|
Загрузка…
Ссылка в новой задаче