From 2ef9a5965fc2bc6b5ce2b075972c651dcf1f8b8e Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Thu, 31 May 2018 23:39:08 +0200 Subject: fix build --- openbsd-compat/bsd-err.h | 29 +++++++++++++++++++++++++++++ openbsd-compat/err.h | 29 ----------------------------- openbsd-compat/xmalloc.c | 4 ++++ 3 files changed, 33 insertions(+), 29 deletions(-) create mode 100644 openbsd-compat/bsd-err.h delete mode 100644 openbsd-compat/err.h (limited to 'openbsd-compat') diff --git a/openbsd-compat/bsd-err.h b/openbsd-compat/bsd-err.h new file mode 100644 index 00000000..f75d0eb4 --- /dev/null +++ b/openbsd-compat/bsd-err.h @@ -0,0 +1,29 @@ +/* + * Public domain + * err.h compatibility shim + */ + +#ifndef HAVE_ERR_H + +#ifndef LIBCRYPTOCOMPAT_ERR_H +#define LIBCRYPTOCOMPAT_ERR_H + +#include +#include +#include + +#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 diff --git a/openbsd-compat/err.h b/openbsd-compat/err.h deleted file mode 100644 index f75d0eb4..00000000 --- a/openbsd-compat/err.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Public domain - * err.h compatibility shim - */ - -#ifndef HAVE_ERR_H - -#ifndef LIBCRYPTOCOMPAT_ERR_H -#define LIBCRYPTOCOMPAT_ERR_H - -#include -#include -#include - -#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 diff --git a/openbsd-compat/xmalloc.c b/openbsd-compat/xmalloc.c index 0f2da917..a6d5c176 100644 --- a/openbsd-compat/xmalloc.c +++ b/openbsd-compat/xmalloc.c @@ -15,7 +15,11 @@ #include "includes.h" +#ifdef HAVE_ERR_H #include +#else +#include "bsd-err.h" +#endif #include #include #include -- cgit v1.2.3-59-g8ed1b