USB device can now be unbind
[AROS.git] / compiler / stdc / stccpy.c
blob2f7da0222946dc15291b6b64f0146684b14bfcf8
1 /*
2 Copyright © 2003-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 SAS/C function stccpy().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
13 size_t stccpy (
15 /* SYNOPSIS */
16 char * dest,
17 const char * src,
18 size_t n)
20 /* FUNCTION
21 Copy a string. Works like an assignment "dest=src;". At most
22 n characters are copied.
24 INPUTS
25 dest - The string is copied into this variable. Make sure it is
26 large enough.
27 src - This is the new contents of dest.
28 n - How many characters to copy at most. If the string src is
29 smaller than that, only strlen(str)+1 bytes are copied.
31 RESULT
32 The number of copied characters.
34 NOTES
35 No check is made that dest is large enough for src.
36 SAS/C specific.
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 strncpy()
45 INTERNALS
47 ******************************************************************************/
49 char * ptr = dest;
51 while (n>1 && *src)
53 *ptr = *src;
54 ptr ++;
55 src ++;
56 n--;
59 *ptr++ = '\0';
61 return (ptr-dest);
62 } /* stccpy */