~ubuntu-branches/ubuntu/wily/grub2/wily-proposed

« back to all changes in this revision

Viewing changes to term/ieee1275/ofconsole.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Zielcke, Robert Millan, Felix Zielcke
  • Date: 2010-01-26 19:26:25 UTC
  • mfrom: (1.13.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100126192625-coq6czap2ofjollf
Tags: 1.98~20100126-1
* New Bazaar snapshot.
  - Includes mipsel-yeeloong port.

[ Robert Millan ]
* config.in: Lower priority of grub2/linux_cmdline_default.

[ Felix Zielcke ]
* Drop `CFLAGS=-O0' workaround on powerpc. Should be fixed correctly now.
* Ship grub-bin2h and grub-script-check in grub-common.
* Terminate NEWS.Debian with a blank line like lintian would suggest
  if that check would be working correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
static void
110
110
grub_ofconsole_setcolorstate (grub_term_color_state state)
111
111
{
112
 
  char setcol[20];
 
112
  char setcol[256];
113
113
  int fg;
114
114
  int bg;
115
115
 
128
128
      return;
129
129
    }
130
130
 
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);
133
133
}
134
134
 
243
243
grub_ofconsole_dimensions (void)
244
244
{
245
245
  grub_ieee1275_ihandle_t options;
246
 
  char *val;
247
246
  grub_ssize_t lval;
248
247
 
249
248
  if (! grub_ieee1275_finddevice ("/options", &options)
250
249
      && options != (grub_ieee1275_ihandle_t) -1)
251
250
    {
252
251
      if (! grub_ieee1275_get_property_length (options, "screen-#columns",
253
 
                                               &lval) && lval != -1)
 
252
                                               &lval)
 
253
          && lval >= 0 && lval < 1024)
254
254
        {
255
 
          val = grub_malloc (lval);
256
 
          if (val)
257
 
            {
258
 
              if (! grub_ieee1275_get_property (options, "screen-#columns",
259
 
                                                val, lval, 0))
260
 
                grub_ofconsole_width = (grub_uint8_t) grub_strtoul (val, 0, 10);
 
255
          char val[lval];
261
256
 
262
 
              grub_free (val);
263
 
            }
 
257
          if (! grub_ieee1275_get_property (options, "screen-#columns",
 
258
                                            val, lval, 0))
 
259
            grub_ofconsole_width = (grub_uint8_t) grub_strtoul (val, 0, 10);
264
260
        }
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)
267
263
        {
268
 
          val = grub_malloc (lval);
269
 
          if (val)
270
 
            {
271
 
              if (! grub_ieee1275_get_property (options, "screen-#rows",
272
 
                                                val, lval, 0))
273
 
                grub_ofconsole_height = (grub_uint8_t) grub_strtoul (val, 0, 10);
274
 
 
275
 
              grub_free (val);
276
 
            }
 
264
          char val[lval];
 
265
          if (! grub_ieee1275_get_property (options, "screen-#rows",
 
266
                                            val, lval, 0))
 
267
            grub_ofconsole_height = (grub_uint8_t) grub_strtoul (val, 0, 10);
277
268
        }
278
269
    }
279
270
 
293
284
static void
294
285
grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y)
295
286
{
296
 
  char s[11]; /* 5 + 3 + 3.  */
297
 
 
298
287
  if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
299
288
    {
 
289
      char s[256];
300
290
      grub_curr_x = x;
301
291
      grub_curr_y = y;
302
292
 
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);
305
295
    }
306
296
  else