1TERMKEY_ADVISEREADABLE(3) Library Functions Manual TERMKEY_ADVISEREADABLE(3)
2
3
4
6 termkey_advisereadable - read more bytes from the underlying terminal
7
9 #include <termkey.h>
10
11 TermKeyResult termkey_advisereadable(TermKey *tk);
12
13 Link with -ltermkey.
14
16 termkey_advisereadable() informs the termkey(7) instance that new input
17 may be available on the underlying file descriptor and so it should
18 call read(2) to obtain it. If at least one more byte was read it will
19 return TERMKEY_RES_AGAIN to indicate it may be useful to call
20 termkey_getkey(3) again. If no more input was read then
21 TERMKEY_RES_NONE is returned. If there was no buffer space remaining,
22 then TERMKEY_RES_ERROR is returned with errno set to ENOMEM. If no
23 filehandle is associated with this instance, TERMKEY_RES_ERROR is re‐
24 turned with errno set to EBADF.
25
26 This function, along with termkey_getkey(3) make it possible to use the
27 termkey instance in an asynchronous program. To provide bytes without
28 using a readable file handle, use termkey_push_bytes(3).
29
30 For synchronous usage, termkey_waitkey(3) performs the input blocking
31 task.
32
34 termkey_advisereadable() returns one of the following constants:
35
36 TERMKEY_RES_AGAIN
37 At least one byte was read.
38
39 TERMKEY_RES_NONE
40 No nore bytes were read.
41
42 TERMKEY_RES_ERROR
43 An IO error occurred. errno will be preserved. If the error is
44 EINTR then this will only be returned if TERMKEY_FLAG_EINTR flag
45 is not set; if it is then the IO operation will be retried in‐
46 stead.
47
49 termkey_getkey(3), termkey_waitkey(3), termkey_set_waittime(3),
50 termkey(7)
51
52
53
54 TERMKEY_ADVISEREADABLE(3)