include err.h shim
Includes compatible replacements, or uses system err.h if available. ok beck@ guenther@
This commit is contained in:
parent
4335a49f51
commit
0ec7cdcbad
@ -111,6 +111,8 @@ AC_CHECK_FUNC(funopen, AC_DEFINE(HAVE_FUNOPEN))
|
||||
|
||||
AC_CHECK_HEADER(sys/sysctl.h, AC_DEFINE(HAVE_SYS_SYSCTL_H))
|
||||
|
||||
AC_CHECK_HEADER(err.h, AC_DEFINE(HAVE_ERR_H))
|
||||
|
||||
AC_ARG_WITH([openssldir],
|
||||
AS_HELP_STRING([--with-openssldir], [Set the default openssl directory]),
|
||||
AC_DEFINE_UNQUOTED(OPENSSLDIR, "$withval")
|
||||
|
@ -1,6 +1,7 @@
|
||||
SUBDIRS = openssl
|
||||
|
||||
noinst_HEADERS = pqueue.h
|
||||
noinst_HEADERS = err.h
|
||||
noinst_HEADERS += pqueue.h
|
||||
noinst_HEADERS += stdlib.h
|
||||
noinst_HEADERS += string.h
|
||||
noinst_HEADERS += unistd.h
|
||||
|
24
include/err.h
Normal file
24
include/err.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifdef HAVE_ERR_H
|
||||
|
||||
#include_next <err.h>
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LIBCRYPTOCOMPAT_ERR_H
|
||||
#define LIBCRYPTOCOMPAT_ERR_H
|
||||
|
||||
#define err(exitcode, format, args...) \
|
||||
errx(exitcode, format ": %s", ## args, strerror(errno))
|
||||
|
||||
#define errx(exitcode, format, args...) \
|
||||
do { warnx(format, ## args); exit(exitcode); } while (0)
|
||||
|
||||
#define warn(format, args...) \
|
||||
warnx(format ": %s", ## args, strerror(errno))
|
||||
|
||||
#define warnx(format, args...) \
|
||||
fprintf(stderr, format "\n", ## args)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user