Contiki 2.6

_SP_printf.c

00001 #define _SMALL_PRINFT
00002 
00003 #ifdef INTEGER_ONLY
00004         #define         _vfprintf_r     _vfiprintf_r 
00005         #define         _vfprintf               _vfiprintf
00006         #define         vfprintf                vfiprintf
00007 #endif
00008 
00009 #include <_ansi.h>
00010 #include <stdio.h>
00011 
00012 #ifndef _SMALL_PRINTF
00013         #include "local.h"
00014 #endif
00015 
00016 #ifdef _HAVE_STDC
00017 #include <stdarg.h>
00018 #else
00019 #include <varargs.h>
00020 #endif
00021 
00022 #ifndef _SMALL_PRINTF
00023 
00024         #ifdef _HAVE_STDC
00025         int
00026         _printf_r (struct _reent *ptr, const char *fmt, ...)
00027         #else
00028         int
00029         _printf_r (ptr, fmt, va_alist)
00030              struct _reent *ptr;
00031              char *fmt;
00032              va_dcl
00033         #endif
00034         {
00035           int ret;
00036           va_list ap;
00037         
00038           //_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
00039         #ifdef _HAVE_STDC
00040           va_start (ap, fmt);
00041         #else
00042           va_start (ap);
00043         #endif
00044           ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
00045           va_end (ap);
00046           return ret;
00047         }
00048 #endif
00049 
00050 #ifndef _REENT_ONLY
00051 
00052 #ifdef _HAVE_STDC
00053 int
00054 printf (const char *fmt, ...)
00055 #else
00056 int
00057 printf (fmt, va_alist)
00058      char *fmt;
00059      va_dcl
00060 #endif
00061 {
00062   int ret;
00063   va_list ap;
00064 
00065   //_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
00066 #ifdef _HAVE_STDC
00067   va_start (ap, fmt);
00068 #else
00069   va_start (ap);
00070 #endif
00071 #ifndef _SMALL_PRINTF
00072   ret = vfprintf (_stdout_r (_REENT), fmt, ap);
00073 #else
00074   ret = vfprintf (0, fmt, ap);
00075 #endif
00076   va_end (ap);
00077   return ret;
00078 }
00079 
00080 #endif /* ! _REENT_ONLY */