2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
6 * © 2009-2011 Michael Stapelberg and contributors
8 * See file LICENSE for license information.
11 #include <sys/types.h>
16 #if defined(__APPLE__)
20 * Returns a pointer to a new string which is a duplicate of the
21 * string, but only copies at most n characters.
24 char *strndup(const char *str, size_t n) {
28 for (len = 0; len < n && str[len]; len++)
31 copy = smalloc(len + 1);
32 memcpy(copy, str, len);