]> sjero.net Git - iperf/blobdiff - compat/error.c
DCCP support for iperf
[iperf] / compat / error.c
index 1d3647e3e4e3b9e497b1efe191b52a7998e67e24..6ba9ab3b3278e3ab83aef36894ba8fe689ee4284 100644 (file)
@@ -101,6 +101,22 @@ void warn_errno( const char *inMessage, const char *inFile, int inLine ) {
 #endif
 } /* end warn_errno */
 
+/* fatal error */
+void die(const char *fmt, ...)
+{
+       va_list ap;
+
+       fflush(stdout);         /* in case stdout and stderr are the same */
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       va_end(ap);
+       if (errno)
+               fprintf(stderr, " (%s)", strerror(errno));
+       fputc('\n', stderr);
+       fflush(stderr);
+       exit(1);
+}
+
 #ifdef __cplusplus
 } /* end extern "C" */
 #endif