diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2012-01-18 13:39:50 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2012-01-18 13:39:50 +0000 |
commit | 82ad14175cbcc7c0c660720c7a31f8e6f1cefe4e (patch) | |
tree | 8c20d19ebbf277de41a1d89167576a4b087f6011 /man/termkey_push_bytes.3 | |
parent | 082b49f0f8790e2cf98346a03c53f492d9d5dcba (diff) | |
download | termo-82ad14175cbcc7c0c660720c7a31f8e6f1cefe4e.tar.gz termo-82ad14175cbcc7c0c660720c7a31f8e6f1cefe4e.tar.xz termo-82ad14175cbcc7c0c660720c7a31f8e6f1cefe4e.zip |
Added termkey_push_bytes(), a new API for providing input bytes
Diffstat (limited to 'man/termkey_push_bytes.3')
-rw-r--r-- | man/termkey_push_bytes.3 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/man/termkey_push_bytes.3 b/man/termkey_push_bytes.3 new file mode 100644 index 0000000..c7dc999 --- /dev/null +++ b/man/termkey_push_bytes.3 @@ -0,0 +1,23 @@ +.TH TERMKEY_PUSH_BYTES 3 +.SH NAME +termkey_push_bytes \- supply more bytes to the input buffer +.SH SYNOPSIS +.nf +.B #include <termkey.h> +.sp +.BI "size_t termkey_push_bytes(TermKey *" tk ", const char *" bytes ", size_t " len "); +.fi +.sp +Link with \fI-ltermkey\fP. +.SH DESCRIPTION +\fBtermkey_push_bytes\fP() allows more bytes of input to be supplied directly into the input buffer of the termkey instance. If there was no buffer space remaining, then -1 is returned with \fIerrno\fP set to \fBENOMEM\fP. +.PP +This function, along with \fBtermkey_getkey\fP(3) make it possible to use the termkey instance in an asynchronous program, or with a source of bytes other than from reading a filehandle. +.PP +For synchronous usage, \fBtermkey_waitkey\fP(3) performs the input blocking task. For use against a regular stream filehandle that supports \fBread\fP(2), see \fBtermkey_advisereadable\fP(3). +.SH "RETURN VALUE" +\fBtermkey_push_bytes\fP() the number of bytes consumed from the input (which may be smaller than the length provided, if the buffer runs out of space) or -1 cast to \fBsize_t\fP if an error occurs. +.SH "SEE ALSO" +.BR termkey_new (3), +.BR termkey_getkey (3), +.BR termkey_advise_readable (3) |