davidgiven / ack

The Amsterdam Compiler Kit
http://tack.sf.net
Other
421 stars 60 forks source link

Add Linux libsys bindings for termios #127

Open Fabrizio-Caruso opened 6 years ago

Fabrizio-Caruso commented 6 years ago

Is there an option or a simple way to produce an ELF Linux binary with unbuffered input? getchar() is buffered by default on Linux systems.

Is this feature available through some APIs?

davidgiven commented 6 years ago

Yes, but it's complicated and not the ACK's responsibility --- you need to put the tty into raw mode using termios or the TCGETA and TCSETA ioctls. Unfortunately, the ACK's libc is missing bindings for these.

Fabrizio-Caruso commented 6 years ago

Thanks a lot for the reply!

Fabrizio-Caruso commented 6 years ago

@davidgiven does this mean that without the bindings in libc, there is no simple way to do this?

Fabrizio-Caruso commented 5 years ago

@davidgiven, I have sent my letter to Santa Claus: I hope one day unbuffered input will be possible (somehow) on ELF binaries.

My understand is that it is currently not possible. Am I right?

davidgiven commented 5 years ago

You can get unbuffered input provided you're willing to use the TCGETA and TCSETA ioctls.

Adding termios bindings is a completely reasonable request; I'll see what I can do.

Fabrizio-Caruso commented 4 years ago

Has there been any progress on this? If not, could you please point me to any doc about TCGETA and TCSETA ioctls with examples on how to use them to read the status of keyboard? Possibly with auto-repeat, i.e., keeping the same key down should produce a key-press any time the status is polled.