1 /* ----------------------------------------------------------------------- *
3 * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 * Boston MA 02110-1301, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
31 static int draw_message_file(const char *filename
)
36 st_init
, /* Base state */
37 st_si_1
, /* <SI> digit 1 */
38 st_si_2
, /* <SI> digit 2 */
39 st_skipline
, /* Skip until NL */
44 f
= fopen(filename
, "r");
48 /* Clear screen, hide cursor, default attribute */
49 printf("\033e\033%%@\033)0\033(B\3#%03d\033[?25l\033[2J\033[H",
50 message_base_color
+ 0x07);
52 while (!eof
&& (ch
= getc(f
)) != EOF
) {
57 fputs("\033[2J\033[H", stdout
);
81 attr
= hexval(ch
) << 4;
87 printf("\3#%03d", attr
+ message_base_color
);
102 int show_message_file(const char *filename
, const char *background
)
105 const char *old_background
= NULL
;
108 old_background
= current_background
;
109 set_background(background
);
112 if (!(rv
= draw_message_file(filename
)))
113 rv
= mygetkey(0); /* Wait for keypress */
116 set_background(old_background
);