aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--termkey.c5
-rw-r--r--termkey.h.in2
-rw-r--r--termkey_get_fd.318
-rw-r--r--termkey_new.33
4 files changed, 27 insertions, 1 deletions
diff --git a/termkey.c b/termkey.c
index b9b2ce0..b8f06e1 100644
--- a/termkey.c
+++ b/termkey.c
@@ -283,6 +283,11 @@ void termkey_destroy(termkey_t *tk)
termkey_free(tk);
}
+int termkey_get_fd(termkey_t *tk)
+{
+ return tk->fd;
+}
+
int termkey_get_flags(termkey_t *tk)
{
return tk->flags;
diff --git a/termkey.h.in b/termkey.h.in
index 7f0dc49..95e8aed 100644
--- a/termkey.h.in
+++ b/termkey.h.in
@@ -137,6 +137,8 @@ termkey_t *termkey_new(int fd, int flags);
void termkey_free(termkey_t *tk);
void termkey_destroy(termkey_t *tk);
+int termkey_get_fd(termkey_t *tk);
+
int termkey_get_flags(termkey_t *tk);
void termkey_set_flags(termkey_t *tk, int newflags);
diff --git a/termkey_get_fd.3 b/termkey_get_fd.3
new file mode 100644
index 0000000..d12a872
--- /dev/null
+++ b/termkey_get_fd.3
@@ -0,0 +1,18 @@
+.TH TERMKEY_GET_FD 3
+.SH NAME
+termkey_get_fd \- obtain the file descriptor for the terminal
+.SH SYNOPSIS
+.nf
+.B #include <termkey.h>
+.sp
+.BI "void termkey_get_fd(termkey_t *" tk );
+.fi
+.sp
+Link with \fI-ltermkey\fP.
+.SH DESCRIPTION
+\fBtermkey_get_fd\fP returns the file descriptor that was passed as the \fIfd\fP argument to \fBtermkey_new\fP(3).
+.SH "RETURN VALUE"
+\fBtermkey_get_fd\fP() returns the current file descriptor.
+.SH "SEE ALSO"
+.BR termkey_new (3),
+.BR termkey_get_flags (3)
diff --git a/termkey_new.3 b/termkey_new.3
index 413d81f..4d099ff 100644
--- a/termkey_new.3
+++ b/termkey_new.3
@@ -48,4 +48,5 @@ If successful, \fBtermkey_new\fP() returns a pointer to the new instance. On fai
.BR termkey_waitkey (3),
.BR termkey_advisereadable (3),
.BR termkey_getkey (3),
-.BR termkey_get_flags (3)
+.BR termkey_get_flags (3),
+.BR termkey_get_fd (3)