From b7a82c980fe7e0c1f9029b55be97422428d65d5a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 11 Jan 2017 09:11:51 +0100 Subject: Clean up code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/util/efflush.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/util/efflush.h (limited to 'src/util/efflush.h') 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 + +#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); +} -- cgit v1.2.3-70-g09d2