autoconf'd vfprintf
[freeglut] / src / freeglut_main.c
index 6f4bcec..d1ba612 100644 (file)
 
 #include <GL/freeglut.h>
 #include "freeglut_internal.h"
+#if HAVE_ERRNO_H
+#    include <errno.h>
+#endif
+#include <stdarg.h>
+#if HAVE_VPRINTF
+#    define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
+#elif HAVE_DOPRNT
+#    define VFPRINTF(s,f,a) _doprnt((f),(a),(s))
+#else
+#    define VFPRINTF(s,f,a)
+#endif
 
-#if TARGET_HOST_UNIX_X11
-#include <errno.h>
-#include <sys/stat.h>
-#elif TARGET_HOST_WIN32
-#elif TARGET_HOST_WINCE
+#if TARGET_HOST_WINCE
 
 typedef struct GXDisplayProperties GXDisplayProperties;
 typedef struct GXKeyList GXKeyList;
@@ -349,8 +356,8 @@ void fgError( const char *fmt, ... )
 
     fprintf( stderr, "freeglut ");
     if( fgState.ProgramName )
-        fprintf (stderr, "(%s): ", fgState.ProgramName);
-    vfprintf( stderr, fmt, ap );
+        fprintf( stderr, "(%s): ", fgState.ProgramName );
+    VFPRINTF( stderr, fmt, ap );
     fprintf( stderr, "\n" );
 
     va_end( ap );
@@ -370,7 +377,7 @@ void fgWarning( const char *fmt, ... )
     fprintf( stderr, "freeglut ");
     if( fgState.ProgramName )
         fprintf( stderr, "(%s): ", fgState.ProgramName );
-    vfprintf( stderr, fmt, ap );
+    VFPRINTF( stderr, fmt, ap );
     fprintf( stderr, "\n" );
 
     va_end( ap );