aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/io.h')
-rw-r--r--src/util/io.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/io.h b/src/util/io.h
new file mode 100644
index 0000000..25f360c
--- /dev/null
+++ b/src/util/io.h
@@ -0,0 +1,12 @@
+/* See LICENSE file for copyright and license details. */
+
+#define ewriteall(...) enwriteall(1, __VA_ARGS__)
+
+int writeall(int fd, void *buf, size_t n);
+
+static inline void
+enwriteall(int status, int fd, void *buf, size_t n, const char *fname)
+{
+ if (writeall(fd, buf, n))
+ enprintf(status, "write %s:", fname);
+}