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/] [viprintf.c] - Blame information for rev 307

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

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 * Copyright (c) 1990 The Regents of the University of California.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms are permitted
6
 * provided that the above copyright notice and this paragraph are
7
 * duplicated in all such forms and that any documentation,
8
 * advertising materials, and other materials related to such
9
 * distribution and use acknowledge that the software was developed
10
 * by the University of California, Berkeley.  The name of the
11
 * University may not be used to endorse or promote products derived
12
 * from this software without specific prior written permission.
13
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
 
18
/*
19
FUNCTION
20
<<viprintf>>, <<vfiprintf>>, <<vsiprintf>>, <<vsniprintf>>, <<vasiprintf>>, <<vasniprintf>>---format argument list (integer only)
21
 
22
INDEX
23
        viprintf
24
INDEX
25
        _viprintf_r
26
INDEX
27
        vfiprintf
28
INDEX
29
        _vfiprintf_r
30
INDEX
31
        vsiprintf
32
INDEX
33
        _vsiprintf_r
34
INDEX
35
        vsniprintf
36
INDEX
37
        _vsniprintf_r
38
INDEX
39
        vasiprintf
40
INDEX
41
        _vasiprintf_r
42
INDEX
43
        vasniprintf
44
INDEX
45
        _vasniprintf_r
46
 
47
ANSI_SYNOPSIS
48
        #include <stdio.h>
49
        #include <stdarg.h>
50
        int viprintf(const char *<[fmt]>, va_list <[list]>);
51
        int vfiprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
52
        int vsiprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
53
        int vsniprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>,
54
                       va_list <[list]>);
55
        int vasiprintf(char **<[strp]>, const char *<[fmt]>, va_list <[list]>);
56
        char *vasniprintf(char *<[str]>, size_t *<[size]>, const char *<[fmt]>,
57
                          va_list <[list]>);
58
 
59
        int _viprintf_r(struct _reent *<[reent]>, const char *<[fmt]>,
60
                        va_list <[list]>);
61
        int _vfiprintf_r(struct _reent *<[reent]>, FILE *<[fp]>,
62
                        const char *<[fmt]>, va_list <[list]>);
63
        int _vsiprintf_r(struct _reent *<[reent]>, char *<[str]>,
64
                        const char *<[fmt]>, va_list <[list]>);
65
        int _vsniprintf_r(struct _reent *<[reent]>, char *<[str]>,
66
                          size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
67
        int _vasiprintf_r(struct _reent *<[reent]>, char **<[str]>,
68
                          const char *<[fmt]>, va_list <[list]>);
69
        char *_vasniprintf_r(struct _reent *<[reent]>, char *<[str]>,
70
                             size_t *<[size]>, const char *<[fmt]>, va_list <[list]>);
71
 
72
DESCRIPTION
73
<<viprintf>>, <<vfiprintf>>, <<vasiprintf>>, <<vsiprintf>>,
74
<<vsniprintf>>, and <<vasniprintf>> are (respectively) variants of
75
<<iprintf>>, <<fiprintf>>, <<asiprintf>>, <<siprintf>>, <<sniprintf>>,
76
and <<asniprintf>>.  They differ only in allowing their caller to pass
77
the variable argument list as a <<va_list>> object (initialized by
78
<<va_start>>) rather than directly accepting a variable number of
79
arguments.  The caller is responsible for calling <<va_end>>.
80
 
81
<<_viprintf_r>>, <<_vfiprintf_r>>, <<_vasiprintf_r>>,
82
<<_vsiprintf_r>>, <<_vsniprintf_r>>, and <<_vasniprintf_r>> are
83
reentrant versions of the above.
84
 
85
RETURNS
86
The return values are consistent with the corresponding functions:
87
 
88
PORTABILITY
89
All of these functions are newlib extensions.
90
 
91
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
92
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
93
*/
94
 
95
#include <_ansi.h>
96
#include <reent.h>
97
#include <stdio.h>
98
#ifdef _HAVE_STDC
99
#include <stdarg.h>
100
#else
101
#include <varargs.h>
102
#endif
103
#include "local.h"
104
 
105
#ifndef _REENT_ONLY
106
 
107
int
108
_DEFUN(viprintf, (fmt, ap),
109
       _CONST char *fmt _AND
110
       va_list ap)
111
{
112
  _REENT_SMALL_CHECK_INIT (_REENT);
113
  return _vfiprintf_r (_REENT, _stdout_r (_REENT), fmt, ap);
114
}
115
 
116
#endif /* !_REENT_ONLY */
117
 
118
int
119
_DEFUN(_viprintf_r, (ptr, fmt, ap),
120
       struct _reent *ptr _AND
121
       _CONST char *fmt   _AND
122
       va_list ap)
123
{
124
  _REENT_SMALL_CHECK_INIT (ptr);
125
  return _vfiprintf_r (ptr, _stdout_r (ptr), fmt, ap);
126
}

powered by: WebSVN 2.1.0

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