[PATCH 05/21] [terminal] add ply_terminal_is_vt() function
Scott James Remnant
scott at ubuntu.com
Wed Mar 17 21:07:33 PDT 2010
We want to be able to query whether a terminal is an ordinary terminal
or a virtual terminal, rather than looking up the vt number and knowing
what the right numbers are, add a function that knows that.
---
src/libply-splash-core/ply-terminal.c | 8 +++++++-
src/libply-splash-core/ply-terminal.h | 1 +
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c
index 7725eb4..a4a9e76 100644
--- a/src/libply-splash-core/ply-terminal.c
+++ b/src/libply-splash-core/ply-terminal.c
@@ -509,6 +509,12 @@ ply_terminal_get_fd (ply_terminal_t *terminal)
}
bool
+ply_terminal_is_vt (ply_terminal_t *terminal)
+{
+ return terminal->vt_number > 0;
+}
+
+bool
ply_terminal_is_open (ply_terminal_t *terminal)
{
return terminal->is_open;
@@ -712,7 +718,7 @@ ply_terminal_activate_vt (ply_terminal_t *terminal)
{
assert (terminal != NULL);
- if (terminal->vt_number <= 0)
+ if (!ply_terminal_is_vt (terminal))
return false;
if (terminal->vt_number == terminal->active_vt)
diff --git a/src/libply-splash-core/ply-terminal.h b/src/libply-splash-core/ply-terminal.h
index 2c9c4f8..d3ac89b 100644
--- a/src/libply-splash-core/ply-terminal.h
+++ b/src/libply-splash-core/ply-terminal.h
@@ -60,6 +60,7 @@ void ply_terminal_free (ply_terminal_t *terminal);
bool ply_terminal_open (ply_terminal_t *terminal);
int ply_terminal_get_fd (ply_terminal_t *terminal);
+bool ply_terminal_is_vt (ply_terminal_t *terminal);
bool ply_terminal_is_open (ply_terminal_t *terminal);
void ply_terminal_close (ply_terminal_t *terminal);
void ply_terminal_reset_colors (ply_terminal_t *terminal);
--
1.7.0
More information about the plymouth
mailing list