Base errc() and warnc() on vwarnc() and verrc() respectively
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/src/err.c b/src/err.c
index e5c604d..4e50510 100644
--- a/src/err.c
+++ b/src/err.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Robert Millan
+ * Copyright © 2011 Guillem Jover <guillem@hadrons.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,15 +32,10 @@
void
warnc(int code, const char *format, ...)
{
- int tmp = errno;
va_list ap;
va_start(ap, format);
-
- errno = code;
- warn(format, ap);
- errno = tmp;
-
+ vwarnc(code, format, ap);
va_end(ap);
}
@@ -59,10 +55,7 @@ errc(int status, int code, const char *format, ...)
va_list ap;
va_start(ap, format);
-
- errno = code;
- err(status, format, ap);
-
+ verrc(status, code, format, ap);
va_end(ap);
}