libdl: end must be bigger than start
[uclibc-ng.git] / libc / string / strncat.c
blob0fa9b4ae1f0dc3789b55b6c2f00deb53b0b9dfbc
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 Wstrncat wcsncat
12 #else
13 # define Wstrncat strncat
14 #endif
16 Wchar *Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2,
17 size_t n)
19 register Wchar *s = s1;
21 while (*s++);
22 --s;
23 while (n && ((*s = *s2++) != 0)) {
24 --n;
25 ++s;
27 *s = 0;
29 return s1;
32 #ifndef WANT_WIDE
33 libc_hidden_def(strncat)
34 #endif