2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
5 * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
13 #if defined(__APPLE__)
17 * Returns a pointer to a new string which is a duplicate of the
18 * string, but only copies at most n characters.
21 char *strndup(const char *str, size_t n) {
25 for (len = 0; len < n && str[len]; len++)
28 copy = smalloc(len + 1);
29 memcpy(copy, str, len);