libdl: first execute all destructors, then munmap library
[uclibc-ng.git] / libc / string / strncpy.c
blob4a44e1f02d4f918c3b00b5b72658669731c8dd4a
1 /*
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.
6 */
8 #include "_string.h"
10 #ifdef WANT_WIDE
11 # define Wstrncpy wcsncpy
12 #else
13 # define Wstrncpy strncpy
14 #endif
16 Wchar *Wstrncpy(Wchar * __restrict s1, register const Wchar * __restrict s2,
17 size_t n)
19 register Wchar *s = s1;
21 while (n) {
22 if ((*s = *s2) != 0) s2++; /* Need to fill tail with 0s. */
23 ++s;
24 --n;
27 return s1;
29 #ifndef WANT_WIDE
30 libc_hidden_def(strncpy)
31 #endif