From 0cfce96280c55463ff72de650889f37d3d98de26 Mon Sep 17 00:00:00 2001 From: Chris Veenboer Date: Tue, 8 Nov 2016 14:52:19 +0100 Subject: [PATCH] Make building on OSX work out of the box (#18) Conditionally declare strlcat() and strlcpy() in proxytunnel.h Conditionally include strlcat.o and strlcpy.o in Makefile --- Makefile | 8 ++++++-- proxytunnel.h | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b378a73..43c3eac 100644 --- a/Makefile +++ b/Makefile @@ -63,8 +63,6 @@ mandir = $(datadir)/man # Remove strlcpy/strlcat on (open)bsd/darwin systems OBJ = proxytunnel.o \ base64.o \ - strlcpy.o \ - strlcat.o \ strzcat.o \ setproctitle.o \ io.o \ @@ -76,6 +74,12 @@ OBJ = proxytunnel.o \ ntlm.o \ ptstream.o +UNAME = $(shell uname) +ifneq ($(UNAME),Darwin) +OBJ += strlcpy.o \ + strlcat.o +endif + .PHONY: all clean docs install all: proxytunnel diff --git a/proxytunnel.h b/proxytunnel.h index b948be0..abfef25 100644 --- a/proxytunnel.h +++ b/proxytunnel.h @@ -32,8 +32,14 @@ void closeall(); void do_daemon(); void initsetproctitle(int argc, char *argv[]); void setproctitle(const char *fmt, ...); + +#if defined(__APPLE__) && defined(__MACH__) +/* Don't include strlcat and strlcpy since they are provided as macros on OSX */ +#else size_t strlcat(char *dst, const char *src, size_t siz); size_t strlcpy(char *dst, const char *src, size_t siz); +#endif + size_t strzcat(char *dst, char *format, ...); int main( int argc, char *argv[] ); char * readpassphrase(const char *, char *, size_t, int);