[RFC PATCH v6] ell/term: Add an 'l_term_is_acquired' introspection function.
Grant Erickson <[email protected]> Wed, 3 Apr 2024 10:22:16 -0700
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
This adds an 'l_term_is_acquired' introspection function that
indicates whether the terminal has acquired and modified the TTY
settings for the input and output descriptors associated with the
terminal.
---
ell/ell.sym | 1 +
ell/term.c | 8 ++++++++
ell/term.h | 2 ++
3 files changed, 11 insertions(+)
diff --git a/ell/ell.sym b/ell/ell.sym
index 0026bbe1afcf..e288d6c32f67 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -632,6 +632,7 @@ global:
l_term_set_output;
l_term_set_output_stdout;
l_term_set_key_handler;
+ l_term_is_acquired;
l_term_acquire;
l_term_release;
l_term_io_callback;
diff --git a/ell/term.c b/ell/term.c
index 86050740e967..ae66b9034c86 100644
--- a/ell/term.c
+++ b/ell/term.c
@@ -241,6 +241,14 @@ static void sigwinch_handler(void *user_data)
&term->num_row, &term->num_col);
}
+LIB_EXPORT bool l_term_is_acquired(struct l_term *term)
+{
+ if (!term)
+ return false;
+
+ return term->is_acquired;
+}
+
LIB_EXPORT int l_term_acquire(struct l_term *term)
{
struct termios termios;
diff --git a/ell/term.h b/ell/term.h
index 50831c166c78..66059212b436 100644
--- a/ell/term.h
+++ b/ell/term.h
@@ -44,6 +44,8 @@ typedef void (*l_term_key_func_t) (struct l_term *term, wint_t wch, void *user_d
int l_term_set_key_handler(struct l_term *term,
l_term_key_func_t handler, void *user_data);
+bool l_term_is_acquired(struct l_term *term);
+
int l_term_acquire(struct l_term *term);
int l_term_release(struct l_term *term);
--
2.42.0