From 3010025998bf85a0f4d09429eddf6444aefeba19 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Tue, 22 Apr 2014 00:33:02 +0000 Subject: [PATCH] Add errc/verrc/warnc/vwarnc family: versions of err/... that take the errno value to use for the strerror() message as an argument. Originally from FreeBSD 3.0 Patch from Steffen Nurpmeso (sdaoden (at) gmail.com) with minor tweaks. --- src/include/err.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/include/err.h b/src/include/err.h index de7f3701..af973685 100644 --- a/src/include/err.h +++ b/src/include/err.h @@ -1,4 +1,4 @@ -/* $OpenBSD: err.h,v 1.11 2014/04/21 16:13:24 guenther Exp $ */ +/* $OpenBSD: err.h,v 1.12 2014/04/22 00:33:02 guenther Exp $ */ /* $NetBSD: err.h,v 1.11 1994/10/26 00:55:52 cgd Exp $ */ /*- @@ -44,6 +44,10 @@ __dead void err(int, const char *, ...) __attribute__((__format__ (printf, 2, 3))); __dead void verr(int, const char *, __va_list) __attribute__((__format__ (printf, 2, 0))); +__dead void errc(int, int, const char *, ...) + __attribute__((__format__ (printf, 3, 4))); +__dead void verrc(int, int, const char *, __va_list) + __attribute__((__format__ (printf, 3, 0))); __dead void errx(int, const char *, ...) __attribute__((__format__ (printf, 2, 3))); __dead void verrx(int, const char *, __va_list) @@ -52,6 +56,10 @@ void warn(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void vwarn(const char *, __va_list) __attribute__((__format__ (printf, 1, 0))); +void warnc(int, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); +void vwarnc(int, const char *, __va_list) + __attribute__((__format__ (printf, 2, 0))); void warnx(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void vwarnx(const char *, __va_list) @@ -64,6 +72,10 @@ __dead void _err(int, const char *, ...) __attribute__((__format__ (printf, 2, 3))); __dead void _verr(int, const char *, __va_list) __attribute__((__format__ (printf, 2, 0))); +__dead void _errc(int, int, const char *, ...) + __attribute__((__format__ (printf, 3, 4))); +__dead void _verrc(int, int, const char *, __va_list) + __attribute__((__format__ (printf, 3, 0))); __dead void _errx(int, const char *, ...) __attribute__((__format__ (printf, 2, 3))); __dead void _verrx(int, const char *, __va_list) @@ -72,6 +84,10 @@ void _warn(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void _vwarn(const char *, __va_list) __attribute__((__format__ (printf, 1, 0))); +void _warnc(int, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); +void _vwarnc(int, const char *, __va_list) + __attribute__((__format__ (printf, 2, 0))); void _warnx(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void _vwarnx(const char *, __va_list)