]> pd.if.org Git - pdclib.old/blobdiff - functions/stdio/fprintf.c
Minimize the amount of internal definitions which get exposed via the user-visible...
[pdclib.old] / functions / stdio / fprintf.c
index cb922bad4bdd0b8621d8f8faa72666b08c2862cb..0227cd4d17ad520dfb99bc21160d060f0ccb93bb 100644 (file)
 #include <stdarg.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-int fprintf( struct _PDCLIB_file_t * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... )
+int fprintf_unlocked( FILE * _PDCLIB_restrict stream, 
+                      const char * _PDCLIB_restrict format, ... )
 {
     int rc;
     va_list ap;
@@ -21,6 +23,19 @@ int fprintf( struct _PDCLIB_file_t * _PDCLIB_restrict stream, const char * _PDCL
     return rc;
 }
 
+int fprintf( FILE * _PDCLIB_restrict stream,
+             const char * _PDCLIB_restrict format, ... )
+{
+    int rc;
+    va_list ap;
+    va_start( ap, format );
+    flockfile( stream );
+    rc = vfprintf_unlocked( stream, format, ap );
+    funlockfile( stream );
+    va_end( ap );
+    return rc;
+}
+
 #endif
 
 #ifdef TEST