1 #define _GNU_SOURCE /* Needed for asprintf() on Linux */
20 static int draw_message_file(const char *filename
)
25 st_init
, /* Base state */
26 st_si_1
, /* <SI> digit 1 */
27 st_si_2
, /* <SI> digit 2 */
28 st_skipline
, /* Skip until NL */
33 f
= fopen(filename
, "r");
37 /* Clear screen, hide cursor, default attribute */
38 printf("\033e\033%%@\033)0\033(B\3#%03d\033[?25l\033[2J\033[H",
39 message_base_color
+0x07);
41 while (!eof
&& (ch
= getc(f
)) != EOF
) {
46 fputs("\033[2J\033[H", stdout
);
70 attr
= hexval(ch
) << 4;
76 printf("\3#%03d", attr
+message_base_color
);
91 int show_message_file(const char *filename
, const char *background
)
95 if (background
&& (!menu_background
|| strcmp(background
, menu_background
)))
96 draw_background(background
);
100 if ( !(rv
= draw_message_file(filename
)) )
101 rv
= mygetkey(0); /* Wait for keypress */
104 draw_background(menu_background
);