]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[terminal] add ply_terminal_is_vt() function
authorScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 04:07:33 +0000 (04:07 +0000)
committerScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 19:56:46 +0000 (19:56 +0000)
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
src/libply-splash-core/ply-terminal.h

index 7725eb4f07d90572c15aa2df3201c0bbef77c020..a4a9e766f3bcfe2ae29388363b59d47979404fbf 100644 (file)
@@ -508,6 +508,12 @@ ply_terminal_get_fd (ply_terminal_t *terminal)
   return terminal->fd;
 }
 
+bool
+ply_terminal_is_vt (ply_terminal_t *terminal)
+{
+  return terminal->vt_number > 0;
+}
+
 bool
 ply_terminal_is_open (ply_terminal_t *terminal)
 {
@@ -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)
index 2c9c4f84ed32acba519a4b7922d2dba65765d596..d3ac89bf4cd2cd2b7609bea84e84c407e138c88c 100644 (file)
@@ -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);