OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdio/] [vdprintf.c] - Blame information for rev 194

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* Copyright 2005, 2007 Shaun Jackman
2
 * Permission to use, copy, modify, and distribute this software
3
 * is freely granted, provided that this notice is preserved.
4
 */
5
/* doc in dprintf.c */
6
 
7
#include <_ansi.h>
8
#include <reent.h>
9
#include <stdio.h>
10
#include <stdlib.h>
11
#include <unistd.h>
12
#include <stdarg.h>
13
#include "local.h"
14
 
15
int
16
_DEFUN(_vdprintf_r, (ptr, fd, format, ap),
17
       struct _reent *ptr _AND
18
       int fd _AND
19
       const char *format _AND
20
       va_list ap)
21
{
22
  char *p;
23
  char buf[512];
24
  size_t n = sizeof buf;
25
 
26
  _REENT_SMALL_CHECK_INIT (ptr);
27
  p = _vasnprintf_r (ptr, buf, &n, format, ap);
28
  if (!p)
29
    return -1;
30
  n = _write_r (ptr, fd, p, n);
31
  if (p != buf)
32
    _free_r (ptr, p);
33
  return n;
34
}
35
 
36
#ifndef _REENT_ONLY
37
 
38
int
39
_DEFUN(vdprintf, (fd, format, ap),
40
       int fd _AND
41
       const char *format _AND
42
       va_list ap)
43
{
44
  return _vdprintf_r (_REENT, fd, format, ap);
45
}
46
 
47
#endif /* ! _REENT_ONLY */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.