diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.cc | 9 | ||||
-rw-r--r-- | src/libutil/util.hh | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 02745498f9fc..54cfc6c7fded 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -404,6 +404,15 @@ void printMsg_(Verbosity level, const format & f) } +void warnOnce(bool & haveWarned, const format & f) +{ + if (!haveWarned) { + printMsg(lvlError, format("warning: %1%") % f.str()); + haveWarned = true; + } +} + + void readFull(int fd, unsigned char * buf, size_t count) { while (count) { diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 22e614d9585e..125ba2695c2c 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -178,6 +178,8 @@ void printMsg_(Verbosity level, const format & f); #define debug(f) printMsg(lvlDebug, f) +void warnOnce(bool & haveWarned, const format & f); + /* Wrappers arount read()/write() that read/write exactly the requested number of bytes. */ |