Path: blob/master/waterbox/libc/functions/stdio/fprintf.c
2 views
/* fprintf( FILE *, 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 <stdarg.h>89#ifndef REGTEST10#include "_PDCLIB_io.h"1112int _PDCLIB_fprintf_unlocked( FILE * _PDCLIB_restrict stream,13const char * _PDCLIB_restrict format, ... )14{15int rc;16va_list ap;17va_start( ap, format );18rc = _PDCLIB_vfprintf_unlocked( stream, format, ap );19va_end( ap );20return rc;21}2223int fprintf( FILE * _PDCLIB_restrict stream,24const char * _PDCLIB_restrict format, ... )25{26int rc;27va_list ap;28va_start( ap, format );29_PDCLIB_flockfile( stream );30rc = _PDCLIB_vfprintf_unlocked( stream, format, ap );31_PDCLIB_funlockfile( stream );32va_end( ap );33return rc;34}3536#endif3738#ifdef TEST39#include <stdint.h>40#include <stddef.h>41#define _PDCLIB_FILEID "stdio/fprintf.c"42#define _PDCLIB_FILEIO4344#include "_PDCLIB_test.h"4546#define testprintf( stream, ... ) fprintf( stream, __VA_ARGS__ )4748int main( void )49{50FILE * target;51TESTCASE( ( target = tmpfile() ) != NULL );52#include "printf_testcases.h"53TESTCASE( fclose( target ) == 0 );54return TEST_RESULTS;55}5657#endif58596061