summaryrefslogtreecommitdiffstats
path: root/lib/printf.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-02 18:10:04 +0200
committerMartin Mares <mj@ucw.cz>2000-05-02 18:10:04 +0200
commit53943a002265d8e2b6a887eaa497a01840675693 (patch)
tree66897b24d24a3840d880c11f89a208981c23bf9e /lib/printf.c
parent85368cd4b7244535f6ce56a27f6d22ddfa2bf4e6 (diff)
downloadbird-53943a002265d8e2b6a887eaa497a01840675693.tar
bird-53943a002265d8e2b6a887eaa497a01840675693.zip
Defined format specifier `%M' which behaves as `%m', but takes the
error code as an argument. Use it in socket hooks where we really shouldn't rely on errno containing the right value or even existing.
Diffstat (limited to 'lib/printf.c')
-rw-r--r--lib/printf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/printf.c b/lib/printf.c
index 64fcf72..a668aea 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -198,6 +198,9 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
case 'm':
s = strerror(errno);
goto str;
+ case 'M':
+ s = strerror(va_arg(args, int));
+ goto str;
case 's':
s = va_arg(args, char *);
if (!s)