OSDN Git Service

hidden_def/hidden_proto: convert all users (I hope) termios split, add some missing...
[uclinux-h8/uClibc.git] / libc / string / strncat.c
1 /*
2  * Copyright (C) 2002     Manuel Novoa III
3  * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
4  *
5  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6  */
7
8 #include "_string.h"
9
10 #ifdef WANT_WIDE
11 # define Wstrncat wcsncat
12 #else
13 libc_hidden_proto(strncat)
14 # define Wstrncat strncat
15 #endif
16
17 Wchar *Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2,
18                                 size_t n)
19 {
20         register Wchar *s = s1;
21
22         while (*s++);
23         --s;
24 #if __BCC__
25         while (n-- && ((*s = *s2++) != 0)) ++s;
26 #else
27         while (n && ((*s = *s2++) != 0)) {
28                 --n;
29                 ++s;
30         }
31 #endif
32         *s = 0;
33
34         return s1;
35 }
36
37 #ifndef WANT_WIDE
38 libc_hidden_def(strncat)
39 #endif