Mac OS X fixes: include string.h, add strndup(), disable xmllint for the docs
This commit is contained in:
parent
3c68a9158c
commit
fef5a69b09
|
@ -2,7 +2,7 @@ all: i3bar.1
|
|||
|
||||
i3bar.1: i3bar.man
|
||||
echo "A2X i3bar"
|
||||
a2x -f manpage i3bar.man
|
||||
a2x --no-xmllint -f manpage i3bar.man
|
||||
clean:
|
||||
rm -f i3bar.xml i3bar.1 i3bar.html
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
|
|
@ -27,6 +27,30 @@
|
|||
|
||||
#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 */
|
||||
enum {
|
||||
#define ATOM_DO(name) name,
|
||||
|
|
Loading…
Reference in New Issue