TERMKEY\_ADVISEREADABLE(3) Library Functions Manual TERMKEY\_ADVISEREADABLE(3)

# [NAME](#NAME)

termkey\_advisereadable - read more bytes from the underlying terminal

# [SYNOPSIS](#SYNOPSIS)

```
#include <termkey.h>

TermKeyResult termkey_advisereadable(TermKey *tk);
```

Link with *-ltermkey*.

# [DESCRIPTION](#DESCRIPTION)

**termkey\_advisereadable**() informs the [**termkey**(7)](/man/os/libtermkey/termkey.7) instance that new input may be available on the underlying file descriptor and so it should call [**read**(2)](/man/os/libtermkey/read.2) to obtain it. If at least one more byte was read it will return **TERMKEY\_RES\_AGAIN** to indicate it may be useful to call [**termkey\_getkey**(3)](/man/os/libtermkey/termkey_getkey.3) again. If no more input was read then **TERMKEY\_RES\_NONE** is returned. If there was no buffer space remaining, then **TERMKEY\_RES\_ERROR** is returned with *errno* set to **ENOMEM**. If no filehandle is associated with this instance, **TERMKEY\_RES\_ERROR** is returned with *errno* set to **EBADF**.

This function, along with [**termkey\_getkey**(3)](/man/os/libtermkey/termkey_getkey.3) make it possible to use the termkey instance in an asynchronous program. To provide bytes without using a readable file handle, use [**termkey\_push\_bytes**(3)](/man/os/libtermkey/termkey_push_bytes.3).

For synchronous usage, [**termkey\_waitkey**(3)](/man/os/libtermkey/termkey_waitkey.3) performs the input blocking task.

# [RETURN VALUE](#RETURN_VALUE)

**termkey\_advisereadable**() returns one of the following constants:

[**TERMKEY\_RES\_AGAIN**](#TERMKEY_RES_AGAIN)

At least one byte was read.

[**TERMKEY\_RES\_NONE**](#TERMKEY_RES_NONE)

No nore bytes were read.

[**TERMKEY\_RES\_ERROR**](#TERMKEY_RES_ERROR)

An IO error occurred. *errno* will be preserved. If the error is **EINTR** then this will only be returned if **TERMKEY\_FLAG\_EINTR** flag is not set; if it is then the IO operation will be retried instead.

# [SEE ALSO](#SEE_ALSO)

[**termkey\_getkey**(3)](/man/os/libtermkey/termkey_getkey.3), [**termkey\_waitkey**(3)](/man/os/libtermkey/termkey_waitkey.3), [**termkey\_set\_waittime**(3)](/man/os/libtermkey/termkey_set_waittime.3), [**termkey**(7)](/man/os/libtermkey/termkey.7)

---

Document: termkey_advisereadable(3) from libtermkey 0.22-r8 (Chainguard OS)
