![[jump to content]](_.gif)
Tools (new)
: keypressed
[ Home
| Scylla+Charybdis old home
| Tools (old)
| Tools (new)
| FAQ
| Downloads
]
Scylla and Charybdis keypressed - Tools
The tools are developed under Linux with
ESR's paradigm
release early, release often
in mind.
So you can consider this beta software, or alpha, or pre-alpha, or even worse ;)
Have a look in the download directory for all downloads.
As always here, all you get is the source. No binaries here.
keypressed 0.0.0-20080530-190401
Nonblocking, nondestructible test for waiting data on TTYs, sockets and probably pipes
(look into latest version, download latest version 0.0.0-20080530-190401, sig)
- Returns 0 (true) if there is input data waiting.
- Returns 1 if no input data waiting.
- Returns 255 on errors.
- Return is undefined on unknown input types.
- Does not read or print anything.
- Does not set tty into CBREAK mode! As the tty usually is in line mode you need to press Enter for keypressed to detect the input
Example 1:
while ! keypressed; do ...; done
Example 2:
while ! keypressed </dev/tty; do ...; done
Limitations and bugs:
- The input data is not touched and stays there to be read
- Commandline is ignored for now
- Only fd0 (stdin) is checked, be sure to use poper IO redirection
-
- No Hangup detection
- Works only on input types which support certain ioctl() and select(), known to work on TTYs and Sockets and maybe Pipes.
- Behavior on unsupported types (files, non-tty devices, often Pipes) therefor is undefined. It depends on your OS if select() signals read (gives true) or not (gives false) or error (gives 2).
This Works is placed under the terms of the Copyright Less License,
see file COPYRIGHT.CLL. USE AT OWN RISK, ABSOLUTELY NO WARRANTY.
Actually this only is a minimum wrapper around a library call.
History:
License and Disclaimer
All you can see here is free software according to the GNU GPL.
Copyright (C)2000-2008 by Valentin
Hilbig
Note that the software comes with absolutely no warranty of any kind.
You use the software at your own risk.
Valentin Hilbig cannot be hold responsible for any unintended damage,
lost data or malfunction of the software you can find here.
|
|
![[end of page - jump back to content]](_.gif)
![[hacker culture]](glider-small.png)
Last modified: 2008-12-27 by Valentin Hilbig
[ Imprint
/ Impressum
]