2006-12-19 04:39:02 +08:00
|
|
|
#include <_ansi.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "c99ppe.h"
|
|
|
|
|
|
|
|
#ifdef _HAVE_STDC
|
|
|
|
#include <stdarg.h>
|
|
|
|
#else
|
|
|
|
#include <varargs.h>
|
|
|
|
#endif
|
|
|
|
|
2007-02-21 04:58:38 +08:00
|
|
|
#ifdef INTEGER_ONLY
|
|
|
|
# define vsnprintf vsniprintf
|
|
|
|
#endif
|
|
|
|
|
2006-12-19 04:39:02 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char* str;
|
|
|
|
unsigned int pad0[ 3 ];
|
|
|
|
size_t size;
|
|
|
|
unsigned int pad1[ 3 ];
|
2007-01-30 11:18:52 +08:00
|
|
|
_CONST char* fmt;
|
2006-12-19 04:39:02 +08:00
|
|
|
unsigned int pad2[ 3 ];
|
|
|
|
va_list ap;
|
|
|
|
} c99_vsnprintf_t;
|
|
|
|
|
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
|
|
|
|
int
|
|
|
|
_DEFUN (vsnprintf, (str, size, fmt, ap),
|
2013-11-18 Sahil Patnayakuni <sahilp@oarcorp.com>
* libc/include/stdio.h, libc/machine/powerpc/vfscanf.c,
libc/machine/spu/fgetpos.c, libc/machine/spu/fgets.c,
libc/machine/spu/fopen.c, libc/machine/spu/fputs.c,
libc/machine/spu/fread.c, libc/machine/spu/freopen.c,
libc/machine/spu/fwrite.c, libc/machine/spu/setbuf.c,
libc/machine/spu/vfprintf.c, libc/machine/spu/vfscanf.c,
libc/machine/spu/vsnprintf.c, libc/machine/spu/vsprintf.c,
libc/machine/spu/vsscanf.c, libc/stdio/asnprintf.c,
libc/stdio/asprintf.c, libc/stdio/dprintf.c,
libc/stdio/fgetpos.c, libc/stdio/fgets.c,
libc/stdio/fmemopen.c, libc/stdio/fopen.c,
libc/stdio/fprintf.c, libc/stdio/fputs.c,
libc/stdio/fread.c, libc/stdio/freopen.c,
libc/stdio/fscanf.c, libc/stdio/fwrite.c,
libc/stdio/printf.c, libc/stdio/scanf.c,
libc/stdio/setbuf.c, libc/stdio/snprintf.c,
libc/stdio/sprintf.c, libc/stdio/sscanf.c,
libc/stdio/vdprintf.c, libc/stdio/vprintf.c,
libc/stdio/vscanf.c, libc/stdio/vsnprintf.c,
libc/stdio/vsprintf.c, libc/stdio/vsscanf.c: Add restrict keyword.
2013-11-19 01:28:06 +08:00
|
|
|
char *__restrict str _AND
|
2006-12-19 04:39:02 +08:00
|
|
|
size_t size _AND
|
2013-11-18 Sahil Patnayakuni <sahilp@oarcorp.com>
* libc/include/stdio.h, libc/machine/powerpc/vfscanf.c,
libc/machine/spu/fgetpos.c, libc/machine/spu/fgets.c,
libc/machine/spu/fopen.c, libc/machine/spu/fputs.c,
libc/machine/spu/fread.c, libc/machine/spu/freopen.c,
libc/machine/spu/fwrite.c, libc/machine/spu/setbuf.c,
libc/machine/spu/vfprintf.c, libc/machine/spu/vfscanf.c,
libc/machine/spu/vsnprintf.c, libc/machine/spu/vsprintf.c,
libc/machine/spu/vsscanf.c, libc/stdio/asnprintf.c,
libc/stdio/asprintf.c, libc/stdio/dprintf.c,
libc/stdio/fgetpos.c, libc/stdio/fgets.c,
libc/stdio/fmemopen.c, libc/stdio/fopen.c,
libc/stdio/fprintf.c, libc/stdio/fputs.c,
libc/stdio/fread.c, libc/stdio/freopen.c,
libc/stdio/fscanf.c, libc/stdio/fwrite.c,
libc/stdio/printf.c, libc/stdio/scanf.c,
libc/stdio/setbuf.c, libc/stdio/snprintf.c,
libc/stdio/sprintf.c, libc/stdio/sscanf.c,
libc/stdio/vdprintf.c, libc/stdio/vprintf.c,
libc/stdio/vscanf.c, libc/stdio/vsnprintf.c,
libc/stdio/vsprintf.c, libc/stdio/vsscanf.c: Add restrict keyword.
2013-11-19 01:28:06 +08:00
|
|
|
_CONST char *__restrict fmt _AND
|
2006-12-19 04:39:02 +08:00
|
|
|
va_list ap)
|
|
|
|
{
|
|
|
|
c99_vsnprintf_t args;
|
2007-02-02 00:43:45 +08:00
|
|
|
|
|
|
|
CHECK_STR_INIT(_REENT);
|
|
|
|
|
2006-12-19 04:39:02 +08:00
|
|
|
args.str = str;
|
|
|
|
args.size = size;
|
|
|
|
args.fmt = fmt;
|
|
|
|
va_copy(args.ap,ap);
|
|
|
|
|
2007-05-24 05:41:17 +08:00
|
|
|
return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
|
2006-12-19 04:39:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* ! _REENT_ONLY */
|