USB device can now be unbind
[AROS.git] / compiler / stdc / strncat.c
blobeb78988404c6df5d84fb3bb8a14d56d39a1283d5
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function strncat().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
13 char * strncat (
15 /* SYNOPSIS */
16 char * dest,
17 const char * src,
18 size_t n)
20 /* FUNCTION
21 Concatenates two strings. If src is longer than n characters, then
22 only the first n characters are copied.
24 INPUTS
25 dest - src is appended to this string. Make sure that there
26 is enough room for src.
27 src - This string is appended to dest
28 n - No more than this number of characters of src are copied.
30 RESULT
31 dest.
33 NOTES
34 The routine makes no checks if dest is large enough. The size of
35 dest must be at least strlen(dest)+n+1.
37 EXAMPLE
38 char buffer[64];
40 strcpy (buffer, "Hello ");
41 strncat (buffer, "World.!!", 6);
43 // Buffer now contains "Hello World."
45 BUGS
47 SEE ALSO
49 INTERNALS
51 ******************************************************************************/
53 char * d = dest;
55 while (*dest)
56 dest ++;
58 while (n && (*dest = *src))
60 n --;
61 dest ++; src ++;
63 *dest = 0; /* null-terminate conctenated string */
65 return d;
66 } /* strncat */