Path: blob/master/waterbox/libc/functions/stdio/sprintf.c
2 views
/* sprintf( char *, const char *, ... )12This file is part of the Public Domain C Library (PDCLib).3Permission is granted to use, modify, and / or redistribute at will.4*/56#include <stdio.h>7#include <stdint.h>8#include <stdarg.h>910#ifndef REGTEST1112int sprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ...)13{14int rc;15va_list ap;16va_start( ap, format );17rc = vsnprintf( s, SIZE_MAX, format, ap ); /* TODO: replace with non-checking call */18va_end( ap );19return rc;20}2122#endif2324#ifdef TEST25#define _PDCLIB_FILEID "stdio/sprintf.c"26#define _PDCLIB_STRINGIO27#include <stddef.h>2829#include "_PDCLIB_test.h"3031#define testprintf( s, ... ) sprintf( s, __VA_ARGS__ )3233int main( void )34{35char target[100];36#include "printf_testcases.h"37return TEST_RESULTS;38}3940#endif414243