]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Restrict terminfo to serial
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 24 Dec 2009 22:20:43 +0000 (23:20 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 24 Dec 2009 22:20:43 +0000 (23:20 +0100)
include/grub/terminfo.h
term/i386/pc/serial.c
term/terminfo.c

index 1ea741e0445ae681f8314c856dfaab338bf111f5..e3a2c170acd350298a138690cb1feb494ee91fd4 100644 (file)
 
 #include <grub/err.h>
 #include <grub/types.h>
+#include <grub/term.h>
 
 char *grub_terminfo_get_current (void);
 grub_err_t grub_terminfo_set_current (const char *);
 
-void grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y);
-void grub_terminfo_cls (void);
-void grub_terminfo_reverse_video_on (void);
-void grub_terminfo_reverse_video_off (void);
-void grub_terminfo_cursor_on (void);
-void grub_terminfo_cursor_off (void);
+void grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y,
+                          grub_term_output_t oterm);
+void grub_terminfo_cls (grub_term_output_t oterm);
+void grub_terminfo_reverse_video_on (grub_term_output_t oterm);
+void grub_terminfo_reverse_video_off (grub_term_output_t oterm);
+void grub_terminfo_cursor_on (grub_term_output_t oterm);
+void grub_terminfo_cursor_off (grub_term_output_t oterm);
 
 #endif /* ! GRUB_TERMINFO_HEADER */
index 3f1c6d062e5c8abd684eb4cd480dc4923ae3a3b1..12612efcd9ebd63a08db6d8f19a6e8c9f61ea117 100644 (file)
@@ -30,6 +30,7 @@
 #define TEXT_WIDTH     80
 #define TEXT_HEIGHT    25
 
+static struct grub_term_output grub_serial_term_output;
 static unsigned int xpos, ypos;
 static unsigned int keep_track = 1;
 static unsigned int registered = 0;
@@ -413,7 +414,7 @@ grub_serial_gotoxy (grub_uint8_t x, grub_uint8_t y)
   else
     {
       keep_track = 0;
-      grub_terminfo_gotoxy (x, y);
+      grub_terminfo_gotoxy (x, y, &grub_serial_term_output);
       keep_track = 1;
 
       xpos = x;
@@ -425,7 +426,7 @@ static void
 grub_serial_cls (void)
 {
   keep_track = 0;
-  grub_terminfo_cls ();
+  grub_terminfo_cls (&grub_serial_term_output);
   keep_track = 1;
 
   xpos = ypos = 0;
@@ -439,10 +440,10 @@ grub_serial_setcolorstate (const grub_term_color_state state)
     {
     case GRUB_TERM_COLOR_STANDARD:
     case GRUB_TERM_COLOR_NORMAL:
-      grub_terminfo_reverse_video_off ();
+      grub_terminfo_reverse_video_off (&grub_serial_term_output);
       break;
     case GRUB_TERM_COLOR_HIGHLIGHT:
-      grub_terminfo_reverse_video_on ();
+      grub_terminfo_reverse_video_on (&grub_serial_term_output);
       break;
     default:
       break;
@@ -454,9 +455,9 @@ static void
 grub_serial_setcursor (const int on)
 {
   if (on)
-    grub_terminfo_cursor_on ();
+    grub_terminfo_cursor_on (&grub_serial_term_output);
   else
-    grub_terminfo_cursor_off ();
+    grub_terminfo_cursor_off (&grub_serial_term_output);
 }
 
 static struct grub_term_input grub_serial_term_input =
index 80ae9b10021c0cf338d500c6c5b7d0f4e1ed91aa..a793564fd641bead7a5303e2878a75ad1a623063 100644 (file)
@@ -108,52 +108,52 @@ grub_terminfo_set_current (const char *str)
 
 /* Wrapper for grub_putchar to write strings.  */
 static void
-putstr (const char *str)
+putstr (const char *str, grub_term_output_t oterm)
 {
   while (*str)
-    grub_putchar (*str++);
+    grub_putcode (*str++, oterm);
 }
 
 /* Move the cursor to the given position starting with "0".  */
 void
-grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y, grub_term_output_t oterm)
 {
-  putstr (grub_terminfo_tparm (term.gotoxy, y, x));
+  putstr (grub_terminfo_tparm (term.gotoxy, y, x), oterm);
 }
 
 /* Clear the screen.  */
 void
-grub_terminfo_cls (void)
+grub_terminfo_cls (grub_term_output_t oterm)
 {
-  putstr (grub_terminfo_tparm (term.cls));
+  putstr (grub_terminfo_tparm (term.cls), oterm);
 }
 
 /* Set reverse video mode on.  */
 void
-grub_terminfo_reverse_video_on (void)
+grub_terminfo_reverse_video_on (grub_term_output_t oterm)
 {
-  putstr (grub_terminfo_tparm (term.reverse_video_on));
+  putstr (grub_terminfo_tparm (term.reverse_video_on), oterm);
 }
 
 /* Set reverse video mode off.  */
 void
-grub_terminfo_reverse_video_off (void)
+grub_terminfo_reverse_video_off (grub_term_output_t oterm)
 {
-  putstr (grub_terminfo_tparm (term.reverse_video_off));
+  putstr (grub_terminfo_tparm (term.reverse_video_off), oterm);
 }
 
 /* Show cursor.  */
 void
-grub_terminfo_cursor_on (void)
+grub_terminfo_cursor_on (grub_term_output_t oterm)
 {
-  putstr (grub_terminfo_tparm (term.cursor_on));
+  putstr (grub_terminfo_tparm (term.cursor_on), oterm);
 }
 
 /* Hide cursor.  */
 void
-grub_terminfo_cursor_off (void)
+grub_terminfo_cursor_off (grub_term_output_t oterm)
 {
-  putstr (grub_terminfo_tparm (term.cursor_off));
+  putstr (grub_terminfo_tparm (term.cursor_off), oterm);
 }
 
 /* GRUB Command.  */