B19: fgets from /dev/tty with echo off broken

Petr Novak Petr.Novak@i.cz
Fri Sep 25 08:35:00 GMT 1998


I was trying to port SSH-1.2.26 with minimal changes under cygwin32. I am
using B19 tools & runtime.

The major problem I have is that reading the passphrase from terminal
fails and sometimes even freezes the Win95 kernel. I am using W95, I did
not try Windows NT.

When you turn echo off using tcsetattr and read a line using fgets, the
fgets works fine while reading from stdin assigned to console, but loops
until the buffer is overflown while reading from FILE *p =
fopen("/dev/tty", "r").

It might have something to do with CRLF conversion not being done
properly, as the fgets routine expects to find a \n or fills up the

Pressing CTRL-BREAK or CTRL-C sometimes stops the program with
signal 2, sometimes does not produce any result (and it is possible to
close the BASH window from which the process was started) and sometimes
hangs the whole W95 kernel.

Any idea where the problem is? I was trying to debug the fgets, ___fill...
and other routines, but I was not able to do it properly.

Thanks in advance,

Petr Novak <Petr.Novak@i.cz>
ICZ a.s.
Zirovnicka 6
CZ-106 00 Praha 10
Ph:  +420 2 2424 5124
Fax: +420 2 2424 5125

For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

More information about the Cygwin mailing list