2 * Copyright (C) 2002 Manuel Novoa III
3 * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
5 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
12 char *strndup(register const char *s1
, size_t n
)
16 n
= strnlen(s1
,n
); /* Avoid problems if s1 not nul-terminated. */
18 if ((s
= malloc(n
+ 1)) != NULL
) {
25 libc_hidden_def(strndup
)