Files
debian
docs
i3-config-wizard
i3-dump-log
i3-input
i3-msg
i3-nagbar
i3bar
include
libi3
Makefile
README
fake_configure_notify.c
font.c
get_colorpixel.c
get_mod_mask.c
ipc_connect.c
ipc_recv_message.c
ipc_send_message.c
root_atom_contents.c
safewrappers.c
strndup.c
ucs2_conversion.c
man
parser-specs
render-tree
src
testcases
tests
yajl-fallback
.gitignore
DEPENDS
GOALS
LICENSE
Makefile
PACKAGE-MAINTAINER
RELEASE-NOTES-4.0
RELEASE-NOTES-4.0.1
RELEASE-NOTES-4.0.2
RELEASE-NOTES-4.1
RELEASE-NOTES-4.1.1
RELEASE-NOTES-4.1.2
common.mk
dump-asy.pl
generate-command-parser.pl
gtk-tree-watch.pl
i3-migrate-config-to-v4
i3-sensible-editor
i3-sensible-pager
i3-sensible-terminal
i3-wsbar
i3.applications.desktop
i3.config
i3.config.keycodes
i3.welcome
i3.xsession.desktop
logo.svg
pseudo-doc.doxygen
show-download-count.sh
i3/libi3/strndup.c
2011-10-25 21:19:38 +01:00

35 lines
645 B
C

/*
* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
* © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include <sys/types.h>
#include <string.h>
#include "libi3.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;
copy = smalloc(len + 1);
memcpy(copy, str, len);
copy[len] = '\0';
return (copy);
}
#endif