Re: isatty: make it return true in Cygwin consoles on native Windows

2019-03-15 Thread Bruno Haible
LRN wrote: > Either way, some things cannot be implemented in a clear and/or performant way > without these. [ntdll] Sure, I don't dispute this. But when it's possible - like in this case with isatty() - I prefer to rely only on the Windows API. Bruno

Re: isatty: make it return true in Cygwin consoles on native Windows

2019-03-15 Thread LRN
On 15.03.2019 22:42, Bruno Haible wrote: > Gisle Vanem asked: >>> I prefer to avoid the ntdll.dll API when possible. >> >> Okay, what's wrong with that? > > 1) It's a violation of abstraction. > > 2) The code you pointed to uses the function NtQueryObject. However, the >Microsoft

Re: isatty: make it return true in Cygwin consoles on native Windows

2019-03-15 Thread Bruno Haible
Gisle Vanem asked: > > I prefer to avoid the ntdll.dll API when possible. > > Okay, what's wrong with that? 1) It's a violation of abstraction. Diagram: Programs | Windows API (kernel32.dll etc.) | NT API (ntdll.dll) | NT

Re: isatty: make it return true in Cygwin consoles on native Windows

2019-03-15 Thread Gisle Vanem
Bruno Haible wrote: What if the .exe has another name? What other names are in common use for this program? No sure. I'll need to check the MinGW-w64 list and motive. Some custom variation of it perhaps? The purpose of your function looks similar to what Mihail Konev did for the MinGW-w64

Re: isatty: make it return true in Cygwin consoles on native Windows

2019-03-15 Thread Bruno Haible
Hi Gisle, > > + && strcmp (buf + strlen (buf) - 11, "\\mintty.exe") == 0) > > What if the .exe has another name? What other names are in common use for this program? > The purpose of your function looks similar to what Mihail Konev > did for the MinGW-w64 project: > >

Re: isatty: make it return true in Cygwin consoles on native Windows

2019-03-15 Thread Gisle Vanem
Bruno Haible wrote: + if (QueryFullProcessImageNameFunc (processHandle, 0, buf, )) +{ + if (strlen (buf) >= 11 + && strcmp (buf + strlen (buf) - 11, "\\mintty.exe") == 0) What if the .exe has another name? The purpose of your function looks

isatty: make it return true in Cygwin consoles on native Windows

2019-03-14 Thread Bruno Haible
When a native Windows program call isatty(STDOUT_FILENO) or isatty(STDIN_FILENO), it returns true for a cmd.exe console but false for a Cygwin console. This makes no sense, because the Cygwin console is just as interactive as the cmd.exe console; only the input/output encoding is different (UTF-8