mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-05-29 23:42:42 +02:00
Base errc() and warnc() on vwarnc() and verrc() respectively
This commit is contained in:
parent
8723226040
commit
3d614131b5
13
src/err.c
13
src/err.c
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2006 Robert Millan
|
* Copyright © 2006 Robert Millan
|
||||||
|
* Copyright © 2011 Guillem Jover <guillem@hadrons.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -31,15 +32,10 @@
|
|||||||
void
|
void
|
||||||
warnc(int code, const char *format, ...)
|
warnc(int code, const char *format, ...)
|
||||||
{
|
{
|
||||||
int tmp = errno;
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
|
vwarnc(code, format, ap);
|
||||||
errno = code;
|
|
||||||
warn(format, ap);
|
|
||||||
errno = tmp;
|
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,10 +55,7 @@ errc(int status, int code, const char *format, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
|
verrc(status, code, format, ap);
|
||||||
errno = code;
|
|
||||||
err(status, format, ap);
|
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user