Merge branch 'darwin-fixes' into next

This commit is contained in:
Michael Stapelberg 2011-08-01 18:09:47 +02:00
commit 784ab40cd1
4 changed files with 30 additions and 1 deletions

View File

@ -71,7 +71,11 @@ LIBS += $(call ldflags_for_lib, x11, X11)
LIBS += $(call ldflags_for_lib, yajl, yajl) LIBS += $(call ldflags_for_lib, yajl, yajl)
LIBS += $(call ldflags_for_lib, libev, ev) LIBS += $(call ldflags_for_lib, libev, ev)
# Please test if -Wl,--as-needed works on your platform and send me a patch.
# it is known not to work on Darwin (Mac OS X)
ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
LDFLAGS += -Wl,--as-needed LDFLAGS += -Wl,--as-needed
endif
ifeq ($(UNAME),NetBSD) ifeq ($(UNAME),NetBSD)
# We need -idirafter instead of -I to prefer the systems iconv over GNU libiconv # We need -idirafter instead of -I to prefer the systems iconv over GNU libiconv

View File

@ -2,7 +2,7 @@ all: i3bar.1
i3bar.1: i3bar.man i3bar.1: i3bar.man
echo "A2X i3bar" echo "A2X i3bar"
a2x -f manpage i3bar.man a2x --no-xmllint -f manpage i3bar.man
clean: clean:
rm -f i3bar.xml i3bar.1 i3bar.html rm -f i3bar.xml i3bar.1 i3bar.html

View File

@ -12,6 +12,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdint.h> #include <stdint.h>
#include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>

View File

@ -27,6 +27,30 @@
#include "common.h" #include "common.h"
#if defined(__APPLE__)
/*
* Taken from FreeBSD
* Returns a pointer to a new string which is a duplicate of the
* string, but only copies at most n characters.
*
*/
char *strndup(const char *str, size_t n) {
size_t len;
char *copy;
for (len = 0; len < n && str[len]; len++)
continue;
if ((copy = malloc(len + 1)) == NULL)
return (NULL);
memcpy(copy, str, len);
copy[len] = '\0';
return (copy);
}
#endif
/* We save the Atoms in an easy to access array, indexed by an enum */ /* We save the Atoms in an easy to access array, indexed by an enum */
enum { enum {
#define ATOM_DO(name) name, #define ATOM_DO(name) name,