($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Grant Erickson <gerickson@nuovations.com>
To: ell@lists.linux.dev
Cc: Marcel Holtmann <marcel@holtmann.org>
Subject: [RFC PATCH v8] ell/term: Add an 'l_term_is_acquired' introspection function.
Date: Thu,  4 Apr 2024 17:36:57 -0700	[thread overview]
Message-ID: <20240405003658.3490494-9-gerickson@nuovations.com> (raw)
In-Reply-To: <20240405003658.3490494-1-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 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);
 
-- 
2.42.0


  parent reply	other threads:[~2024-04-05  0:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  0:36 [RFC PATCH v8] Input/Output Terminal Abstraction Grant Erickson
2024-04-05  0:36 ` [RFC PATCH v8] term: Initial revision Grant Erickson
2024-04-05  0:36 ` [RFC PATCH v8] ell: Add include directive for 'ell/term.h' Grant Erickson
2024-04-05  0:36 ` [RFC PATCH v8] ell/Makefile: Added 'term.[ch]' to HEADERS and SOURCES Grant Erickson
2024-04-05  0:36 ` [RFC PATCH v8] term: Added 'l_term_*' symbols Grant Erickson
2024-05-16  8:16   ` Martin Hundebøll
2024-05-16 15:35     ` Grant Erickson
2024-04-05  0:36 ` [RFC PATCH v8] ell/term: Do not return -EPERM for 'putnstr' and 'vprint' if not running Grant Erickson
2024-04-05  0:36 ` [RFC PATCH v8] ell/term: Return error on writes if the output descriptor is invalid Grant Erickson
2024-04-05  0:36 ` [RFC PATCH v8] ell/edit: Rename 'l_term_{open,close}' Grant Erickson
2024-04-05  0:36 ` Grant Erickson [this message]
2024-04-05  0:36 ` [RFC PATCH v8] ell/term: Added ASCII C0 and C1 control code mnemonics Grant Erickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240405003658.3490494-9-gerickson@nuovations.com \
    --to=gerickson@nuovations.com \
    --cc=ell@lists.linux.dev \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).