1
2 #include <_ansi.h>
3 #include <stdio.h>
4
5 #include "local.h"
6
7 #ifdef _HAVE_STDC
8 #include <stdarg.h>
9 #else
10 #include <varargs.h>
11 #endif
12
13 #ifdef _HAVE_STDC
14 int
_printf_r(struct _reent * ptr,const char * fmt,...)15 _printf_r (struct _reent *ptr, const char *fmt, ...)
16 #else
17 int
18 _printf_r (ptr, fmt, va_alist)
19 struct _reent *ptr;
20 char *fmt;
21 va_dcl
22 #endif
23 {
24 int ret;
25 va_list ap;
26
27 _REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
28 #ifdef _HAVE_STDC
29 va_start (ap, fmt);
30 #else
31 va_start (ap);
32 #endif
33 ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
34 va_end (ap);
35 return ret;
36 }
37
38 #ifndef _REENT_ONLY
39
40 #ifdef _HAVE_STDC
41 int
printf(const char * fmt,...)42 printf (const char *fmt, ...)
43 #else
44 int
45 printf (fmt, va_alist)
46 char *fmt;
47 va_dcl
48 #endif
49 {
50 int ret;
51 va_list ap;
52
53 _REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
54 #ifdef _HAVE_STDC
55 va_start (ap, fmt);
56 #else
57 va_start (ap);
58 #endif
59 ret = vfprintf (_stdout_r (_REENT), fmt, ap);
60 va_end (ap);
61 return ret;
62 }
63
64 #endif /* ! _REENT_ONLY */
65