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

Subversion Repositories or1k

[/] [or1k/] [tags/] [tn_m001/] [newlib/] [newlib/] [libc/] [stdio/] [vsnprintf.c] - Blame information for rev 1780

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

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

powered by: WebSVN 2.1.0

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