mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-04-18 23:41:12 +02:00
Add errc, warnc, verrc and vwarnc
This commit is contained in:
parent
bc2b90c07b
commit
33eb3ecc41
@ -1,3 +1,11 @@
|
|||||||
|
2006-02-10 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
|
Add errc, warnc, verrc and vwarnc.
|
||||||
|
* err.c: New.
|
||||||
|
* include/bsd/err.h: New.
|
||||||
|
* Versions: Add them.
|
||||||
|
* Makefile: Add err.c and include/bsd/err.h.
|
||||||
|
|
||||||
2005-12-19 Aurelien Jarno <aurel32@debian.org>
|
2005-12-19 Aurelien Jarno <aurel32@debian.org>
|
||||||
|
|
||||||
* Added manpages
|
* Added manpages
|
||||||
|
4
Makefile
4
Makefile
@ -4,9 +4,9 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
LIB_SRCS = arc4random.c fgetln.c inet_net_pton.c strlcat.c strlcpy.c md5c.c fmtcheck.c
|
LIB_SRCS = arc4random.c err.c fgetln.c inet_net_pton.c strlcat.c strlcpy.c md5c.c fmtcheck.c
|
||||||
|
|
||||||
LIB_INCLUDES = include/bsd/ip_icmp.h include/bsd/random.h include/bsd/queue.h include/bsd/md5.h include/bsd/string.h include/bsd/bsd.h include/bsd/stdlib.h
|
LIB_INCLUDES = include/bsd/err.h include/bsd/ip_icmp.h include/bsd/random.h include/bsd/queue.h include/bsd/md5.h include/bsd/string.h include/bsd/bsd.h include/bsd/stdlib.h
|
||||||
|
|
||||||
LIB_MANS = man/arc4random.3 man/strlcpy.3 man/fgetln.3 man/fmtcheck.3
|
LIB_MANS = man/arc4random.3 man/strlcpy.3 man/fgetln.3 man/fmtcheck.3
|
||||||
|
|
||||||
|
1
Versions
1
Versions
@ -1,6 +1,7 @@
|
|||||||
LIBBSD_0.0 {
|
LIBBSD_0.0 {
|
||||||
global:
|
global:
|
||||||
arc4random;
|
arc4random;
|
||||||
|
errc; warnc; verrc; vwarnc;
|
||||||
fgetln;
|
fgetln;
|
||||||
fgetwln;
|
fgetwln;
|
||||||
fmtcheck;
|
fmtcheck;
|
||||||
|
63
err.c
Normal file
63
err.c
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/* Copyright (C) 2006 Robert Millan
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with the GNU C Library; if not, write to the Free
|
||||||
|
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
02110-1301, USA. */
|
||||||
|
|
||||||
|
#include <bsd/err.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
warnc (int code, const char *format, ...)
|
||||||
|
{
|
||||||
|
int tmp = errno;
|
||||||
|
va_list ap;
|
||||||
|
va_start (ap, format);
|
||||||
|
|
||||||
|
errno = code;
|
||||||
|
warn (format, ap);
|
||||||
|
errno = tmp;
|
||||||
|
|
||||||
|
va_end (ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
vwarnc (int code, const char *format, va_list ap)
|
||||||
|
{
|
||||||
|
int tmp = errno;
|
||||||
|
|
||||||
|
errno = code;
|
||||||
|
vwarn (format, ap);
|
||||||
|
errno = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
errc (int status, int code, const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start (ap, format);
|
||||||
|
|
||||||
|
errno = code;
|
||||||
|
err (status, format, ap);
|
||||||
|
|
||||||
|
va_end (ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
verrc (int status, int code, const char *format, va_list ap)
|
||||||
|
{
|
||||||
|
errno = code;
|
||||||
|
verr (status, format, ap);
|
||||||
|
}
|
11
include/bsd/err.h
Normal file
11
include/bsd/err.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef LIBBSD_ERR_H
|
||||||
|
#define LIBBSD_ERR_H
|
||||||
|
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
|
extern void warnc (int code, const char *format, ...);
|
||||||
|
extern void vwarnc (int code, const char *format, va_list ap);
|
||||||
|
extern void errc (int status, int code, const char *format, ...);
|
||||||
|
extern void verrc (int status, int code, const char *format, va_list ap);
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user