This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

termios usage - unblocked single character read from terminal


I have some old code I'm trying to port to cygwin. It uses termios and what
I'm trying to do is read a single key without waiting. I've attached a
simple C source module that sets termios up in the same manner my larger
code does. I've compiled it on RH 8 using the provided gcc 3.2 and it works
the way I desire: prints -1 continually until a key is hit, then it prints
the decimal and ASCII value of the key, then goes back to printing many -1s
until the user hits the q key.

If I set CYGWIN=tty the code (getchar) waits (doesn't printf anything) until
the first key is hit, then getchar returns 0 on successive calls, but no
keys are read. I have to exit the code by using ^C.

If CYGWIN is unset, the getchar call always waits for a key to be hit (not
what I want), and returns the proper value.

Is there something else I should set in my CYGWIN environment variable, or
termios structure?

Pete Stieber

Attachment: cygcheck.txt
Description: Text document

Attachment: terminal2.c
Description: Binary data

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]