From 3a7fe6982a15543de44a51a7cb7fe11afd2c8c65 Mon Sep 17 00:00:00 2001 From: Alexander Demin Date: Tue, 21 Dec 2021 12:41:19 +0000 Subject: [PATCH] Add Darwin platform --- compat.h | 10 ++++++++++ configure | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/compat.h b/compat.h index 049cef7..7dab7f6 100644 --- a/compat.h +++ b/compat.h @@ -43,6 +43,8 @@ #ifndef HAVE_BZERO # define bzero(buf, len) memset ((buf), 0, (len)); +#else +void bzero(void *s, size_t n); #endif #ifndef HAVE_STRTONUM @@ -55,4 +57,12 @@ long long strtonum (const char *, long long, long long, const char **); char *fgetln (FILE *, size_t *); #endif +#ifdef HAVE_SNPRINTF +int snprintf(char *restrict s, size_t n, const char *restrict format, ...); +#endif + +#ifdef HAVE_GETOPT +# include +#endif + #endif /* COMPAT_H */ diff --git a/configure b/configure index 7150f1b..5f9d5f9 100755 --- a/configure +++ b/configure @@ -64,6 +64,21 @@ EOF cat <>$CONFIG_MK CFLAGS+= -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE LIBS+= -lncurses +SRCS+= compat/fgetln.c \ + compat/strtonum.c +EOF + ;; +# ------------------------------------------------------------------------------ + Darwin) + cat <>$CONFIG_H +#define HAVE_NCURSES_H +#define HAVE_BZERO +#define HAVE_SNPRINTF +#define HAVE_GETOPT +EOF + cat <>$CONFIG_MK +CFLAGS+= -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE +LIBS+= -lncurses SRCS+= compat/fgetln.c \ compat/strtonum.c EOF