fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / stdio / iprintf.c
blobdc91b12fa851961387b62c91afac9c90324c5094
1 /*
2 FUNCTION
3 <<iprintf>>---write formatted output (integer only)
4 INDEX
5 iprintf
7 ANSI_SYNOPSIS
8 #include <stdio.h>
10 int iprintf(const char *<[format]>, ...);
12 TRAD_SYNOPSIS
13 #include <stdio.h>
15 int iprintf(<[format]> [, <[arg]>, ...])
16 char *<[format]>;
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.
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>>.
31 PORTABILITY
32 <<iprintf>> is not required by ANSI C.
34 Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
35 <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
38 #include <_ansi.h>
39 #include <stdio.h>
41 #include "local.h"
43 #ifdef _HAVE_STDC
44 #include <stdarg.h>
45 #else
46 #include <varargs.h>
47 #endif
49 #ifndef _REENT_ONLY
51 #ifdef _HAVE_STDC
52 int
53 iprintf (const char *fmt,...)
54 #else
55 int
56 iprintf (fmt, va_alist)
57 char *fmt;
58 va_dcl
59 #endif
61 int ret;
62 va_list ap;
64 _REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
65 #ifdef _HAVE_STDC
66 va_start (ap, fmt);
67 #else
68 va_start (ap);
69 #endif
70 ret = vfiprintf (stdout, fmt, ap);
71 va_end (ap);
72 return ret;
75 #endif /* ! _REENT_ONLY */
77 #ifdef _HAVE_STDC
78 int
79 _iprintf_r (struct _reent *ptr, const char *fmt, ...)
80 #else
81 int
82 _iprintf_r (data, fmt, va_alist)
83 char *data;
84 char *fmt;
85 va_dcl
86 #endif
88 int ret;
89 va_list ap;
91 _REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
92 #ifdef _HAVE_STDC
93 va_start (ap, fmt);
94 #else
95 va_start (ap);
96 #endif
97 ret = vfiprintf (_stdout_r (ptr), fmt, ap);
98 va_end (ap);
99 return ret;