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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [stdio/] [vsprintf.c] - Blame information for rev 1773

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

Line No. Rev Author Line
1 1010 ivang
/* doc in vfprintf.c */
2
 
3
/*
4
 * Copyright (c) 1990 The Regents of the University of California.
5
 * All rights reserved.
6
 *
7
 * Redistribution and use in source and binary forms are permitted
8
 * provided that the above copyright notice and this paragraph are
9
 * duplicated in all such forms and that any documentation,
10
 * advertising materials, and other materials related to such
11
 * distribution and use acknowledge that the software was developed
12
 * by the University of California, Berkeley.  The name of the
13
 * University may not be used to endorse or promote products derived
14
 * from this software without specific prior written permission.
15
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18
 */
19
 
20
#if defined(LIBC_SCCS) && !defined(lint)
21
static char sccsid[] = "%W% (Berkeley) %G%";
22
#endif /* LIBC_SCCS and not lint */
23
 
24
#include <_ansi.h>
25
#include <reent.h>
26
#include <stdio.h>
27
#include <limits.h>
28
#ifdef _HAVE_STDC
29
#include <stdarg.h>
30
#else
31
#include <varargs.h>
32
#endif
33
 
34
int
35
_DEFUN (vsprintf, (str, fmt, ap),
36
     char *str _AND
37
     _CONST char *fmt _AND
38
     va_list ap)
39
{
40
  int ret;
41
  FILE f;
42
 
43
  f._flags = __SWR | __SSTR;
44
  f._bf._base = f._p = (unsigned char *) str;
45
  f._bf._size = f._w = INT_MAX;
46
  f._data = _REENT;
47
  ret = vfprintf (&f, fmt, ap);
48
  *f._p = 0;
49
  return ret;
50
}
51
 
52
int
53
_DEFUN (_vsprintf_r, (ptr, str, fmt, ap),
54
     struct _reent *ptr _AND
55
     char *str _AND
56
     _CONST char *fmt _AND
57
     va_list ap)
58
{
59
  int ret;
60
  FILE f;
61
 
62
  f._flags = __SWR | __SSTR;
63
  f._bf._base = f._p = (unsigned char *) str;
64
  f._bf._size = f._w = INT_MAX;
65
  f._data = ptr;
66
  ret = _vfprintf_r (ptr, &f, fmt, ap);
67
  *f._p = 0;
68
  return ret;
69
}
70
 

powered by: WebSVN 2.1.0

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