[PATCH v9 8/9] ell/term: Add an 'l_term_is_acquired' introspection function.
Grant Erickson <[email protected]> Sun, 6 Apr 2025 15:06:04 -0700
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <e7f27b91a0a1bf3a234dbcbdce03d0cfea5b27c8.1743976923.git.gerickson@nuovations.com> |
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 2e198bd57461..9c149d717e48 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -652,6 +652,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 f3801bcb1200..a56ede4e98ec 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.45.0