aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/efflush.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/efflush.h')
-rw-r--r--src/util/efflush.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/efflush.h b/src/util/efflush.h
new file mode 100644
index 0000000..001f2af
--- /dev/null
+++ b/src/util/efflush.h
@@ -0,0 +1,12 @@
+/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
+
+#define efflush(...) enfflush(1, __VA_ARGS__)
+
+static inline void
+enfflush(int status, FILE *fp, const char *fname)
+{
+ fflush(fp);
+ if (ferror(fp))
+ enprintf(status, "%s:", fname);
+}