]> pd.if.org Git - pdclib/blob - functions/string/strncat.c
Added Makefile and moved internal headers into seperate directory (allowing easier...
[pdclib] / functions / string / strncat.c
1 /* $Id$ */
2
3 /* Release $Name$ */
4
5 /* strncat( char *, const char *, size_t )
6
7    This file is part of the Public Domain C Library (PDCLib).
8    Permission is granted to use, modify, and / or redistribute at will.
9 */
10
11 #include <_PDCLIB_aux.h>
12 #include <string.h>
13
14 char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n )
15 {
16     char * rc = s1;
17     while ( *s1 )
18     {
19         ++s1;
20     }
21     while ( n && ( *s1++ = *s2++ ) )
22     {
23         --n;
24     }
25     if ( n == 0 )
26     {
27         *s1 = '\0';
28     }
29     return rc;
30 }
31
32 #warning Test driver missing.