Don't try to setup and use X11 shared memory if
[tangerine.git] / compiler / clib / stccpy.c
blob82a41854fd7e718c6857c0cc6162d45776e08472
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
5 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 beeing made that dest is large enough for src.
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 strncpy()
44 INTERNALS
46 ******************************************************************************/
48 char * ptr = dest;
50 while (n>1 && *src)
52 *ptr = *src;
53 ptr ++;
54 src ++;
55 n--;
58 *ptr++ = '\0';
60 return (ptr-dest);
61 } /* stccpy */