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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [stdio/] [iprintf.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/*
2
FUNCTION
3
        <<iprintf>>---write formatted output (integer only)
4
INDEX
5
        iprintf
6
 
7
ANSI_SYNOPSIS
8
        #include <stdio.h>
9
 
10
        int iprintf(const char *<[format]>, ...);
11
 
12
TRAD_SYNOPSIS
13
        #include <stdio.h>
14
 
15
        int iprintf(<[format]> [, <[arg]>, ...])
16
        char *<[format]>;
17
 
18
DESCRIPTION
19
<<iprintf>> is a restricted version of <<printf>>: it has the same
20
arguments and behavior, save that it cannot perform any floating-point
21
formatting: the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
22
are not recognized.
23
 
24
RETURNS
25
        <<iprintf>> returns the number of bytes in the output string,
26
        save that the concluding <<NULL>> is not counted.
27
        <<iprintf>> returns when the end of the format string is
28
        encountered.  If an error occurs, <<iprintf>>
29
        returns <<EOF>>.
30
 
31
PORTABILITY
32
<<iprintf>> is not required by ANSI C.
33
 
34
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
35
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
36
*/
37
 
38
#include <_ansi.h>
39
#include <stdio.h>
40
 
41
#ifndef _REENT_ONLY
42
 
43
#ifdef _HAVE_STDC
44
 
45
#include <stdarg.h>
46
 
47
int
48
iprintf (const char *fmt,...)
49
{
50
  int ret;
51
  va_list ap;
52
 
53
  va_start (ap, fmt);
54
  _stdout_r (_REENT)->_data = _REENT;
55
  ret = vfiprintf (stdout, fmt, ap);
56
  va_end (ap);
57
  return ret;
58
}
59
 
60
#else
61
 
62
#include <varargs.h>
63
 
64
int
65
iprintf (fmt, va_alist)
66
     char *fmt;
67
     va_dcl
68
{
69
  int ret;
70
  va_list ap;
71
 
72
  va_start (ap);
73
  _stdout_r (_REENT)->_data = _REENT;
74
  ret = vfiprintf (stdout, fmt, ap);
75
  va_end (ap);
76
  return ret;
77
}
78
 
79
#endif /* ! _HAVE_STDC */
80
#endif /* ! _REENT_ONLY */
81
 
82
#ifdef _HAVE_STDC
83
 
84
#include <stdarg.h>
85
 
86
int
87
_iprintf_r (struct _reent *ptr, const char *fmt, ...)
88
{
89
  int ret;
90
  va_list ap;
91
 
92
  va_start (ap, fmt);
93
  ret = vfiprintf (_stdout_r (ptr), fmt, ap);
94
  va_end (ap);
95
  return ret;
96
}
97
 
98
#else
99
 
100
#include <varargs.h>
101
 
102
int
103
_iprintf_r (data, fmt, va_alist)
104
     char *data;
105
     char *fmt;
106
     va_dcl
107
{
108
  int ret;
109
  struct _reent *ptr = data;
110
  va_list ap;
111
 
112
  va_start (ap);
113
  ret = vfiprintf (_stdout_r (ptr), fmt, ap);
114
  va_end (ap);
115
  return ret;
116
}
117
 
118
#endif

powered by: WebSVN 2.1.0

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