131
grub_sprintf (setcol, "\e[3%dm\e[4%dm", fg, bg);
131
grub_snprintf (setcol, sizeof (setcol), "\e[3%dm\e[4%dm", fg, bg);
132
132
grub_ofconsole_writeesc (setcol);
243
243
grub_ofconsole_dimensions (void)
245
245
grub_ieee1275_ihandle_t options;
247
246
grub_ssize_t lval;
249
248
if (! grub_ieee1275_finddevice ("/options", &options)
250
249
&& options != (grub_ieee1275_ihandle_t) -1)
252
251
if (! grub_ieee1275_get_property_length (options, "screen-#columns",
253
&lval) && lval != -1)
253
&& lval >= 0 && lval < 1024)
255
val = grub_malloc (lval);
258
if (! grub_ieee1275_get_property (options, "screen-#columns",
260
grub_ofconsole_width = (grub_uint8_t) grub_strtoul (val, 0, 10);
257
if (! grub_ieee1275_get_property (options, "screen-#columns",
259
grub_ofconsole_width = (grub_uint8_t) grub_strtoul (val, 0, 10);
265
if (! grub_ieee1275_get_property_length (options, "screen-#rows",
266
&lval) && lval != -1)
261
if (! grub_ieee1275_get_property_length (options, "screen-#rows", &lval)
262
&& lval >= 0 && lval < 1024)
268
val = grub_malloc (lval);
271
if (! grub_ieee1275_get_property (options, "screen-#rows",
273
grub_ofconsole_height = (grub_uint8_t) grub_strtoul (val, 0, 10);
265
if (! grub_ieee1275_get_property (options, "screen-#rows",
267
grub_ofconsole_height = (grub_uint8_t) grub_strtoul (val, 0, 10);
294
285
grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y)
296
char s[11]; /* 5 + 3 + 3. */
298
287
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
303
grub_sprintf (s, "\e[%d;%dH", y + 1, x + 1);
293
grub_snprintf (s, sizeof (s), "\e[%d;%dH", y + 1, x + 1);
304
294
grub_ofconsole_writeesc (s);