diff mbox series

[RFC,v7] ell/term: Add an 'l_term_is_acquired' introspection function.

Message ID 20240404233826.3466674-9-gerickson@nuovations.com (mailing list archive)
State New
Headers show
Series [RFC,v7] ell/term: Add an 'l_term_is_acquired' introspection function. | expand

Checks

Context Check Description
tedd_an/pre-ci_am fail error: patch failed: ell/ell.sym:632 error: ell/ell.sym: patch does not apply error: ell/term.c: does not exist in index error: ell/term.h: does not exist in index hint: Use 'git am --show-current-patch' to see the failed patch

Commit Message

Grant Erickson April 4, 2024, 11:38 p.m. UTC
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 mbox series

Patch

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 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);