Ejemplo n.º 1
0
int
grub_vprintf (const char *fmt, va_list args)
{
  grub_size_t s;
  static char buf[PREALLOC_SIZE + 1];
  char *curbuf = buf;
  va_list ap2;
  va_copy (ap2, args);

  s = grub_vsnprintf_real (buf, PREALLOC_SIZE, fmt, args);
  if (s > PREALLOC_SIZE)
    {
      curbuf = grub_malloc (s + 1);
      if (!curbuf)
	{
	  grub_errno = GRUB_ERR_NONE;
	  buf[PREALLOC_SIZE - 3] = '.';
	  buf[PREALLOC_SIZE - 2] = '.';
	  buf[PREALLOC_SIZE - 1] = '.';
	  buf[PREALLOC_SIZE] = 0;
	}
      else
	s = grub_vsnprintf_real (curbuf, s, fmt, ap2);
    }

  grub_xputs (curbuf);

  if (curbuf != buf)
    grub_free (curbuf);
  
  return s;
}
Ejemplo n.º 2
0
int
grub_vprintf (const char *fmt, va_list args)
{
  int ret;

  ret = grub_vsnprintf_real (0, 0, fmt, args);
  return ret;
}