]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
move switch_to_vt to ply-utils and rename it ply_switch_to_vt
authorFrederic Crozat <fcrozat@mandriva.com>
Fri, 4 Sep 2009 14:19:38 +0000 (16:19 +0200)
committerFrederic Crozat <fcrozat@mandriva.com>
Fri, 4 Sep 2009 14:19:38 +0000 (16:19 +0200)
src/libply/ply-utils.c
src/libply/ply-utils.h
src/main.c

index eb33466630ab54d97870abd51b8522606074dabd..37b986be9272ef59e9e481d2859ac88ffdc69bb7 100644 (file)
@@ -42,6 +42,7 @@
 #include <sys/un.h>
 #include <time.h>
 #include <linux/fs.h>
+#include <linux/vt.h>
 
 #include <dlfcn.h>
 
@@ -893,4 +894,25 @@ ply_utf8_string_get_length (const char   *string,
   return count;
 }
 
+void
+ply_switch_to_vt (int vt_number)
+{
+    int fd;
+
+    fd = open ("/dev/tty0", O_RDWR | O_NOCTTY);
+
+    if (fd < 0)
+      return;
+
+  if (ioctl (fd, VT_ACTIVATE, vt_number) < 0)
+    {
+      close (fd);
+      return;
+    }
+
+  ioctl (fd, VT_WAITACTIVE, vt_number);
+  close (fd);
+}
+
+
 /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
index 592a8e4e439ea38ccf9a429ef1fbf5a30b464d37..62149ba3925e61e75459d34bc708f5061d5c64b3 100644 (file)
@@ -104,6 +104,8 @@ int ply_utf8_character_get_size (const char   *string,
 int ply_utf8_string_get_length (const char   *string,
                                 size_t        n);
 
+void ply_switch_to_vt (int vt_number);
+
 #endif
 
 #endif /* PLY_UTILS_H */
index a92e11f20774b61ce052ffcd69ae92a8349b2eee..3bf156885f76db833cbf8bc3a1b72fbd81312d80 100644 (file)
@@ -125,26 +125,6 @@ static void on_error_message (ply_buffer_t *debug_buffer,
 static ply_buffer_t *debug_buffer;
 static char *debug_buffer_path = NULL;
 
-static void
-switch_to_vt (int vt_number)
-{
-    int fd;
-
-    fd = open ("/dev/tty0", O_RDWR | O_NOCTTY);
-
-    if (fd < 0)
-      return;
-
-  if (ioctl (fd, VT_ACTIVATE, vt_number) < 0)
-    {
-      close (fd);
-      return;
-    }
-
-  ioctl (fd, VT_WAITACTIVE, vt_number);
-  close (fd);
-}
-
 static void
 on_session_output (state_t    *state,
                    const char *output,
@@ -1277,7 +1257,7 @@ initialize_environment (state_t *state)
   if (state->mode == PLY_MODE_SHUTDOWN)
     {
       default_tty = "tty63";
-      switch_to_vt (63);
+      ply_switch_to_vt (63);
     }
   else
     default_tty = "tty1";