1 /* strncat( char *, const char *, size_t )
3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
11 char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n )
18 while ( n && ( *s1++ = *s2++ ) )
33 #include "_PDCLIB_test.h"
37 char s[] = "xx\0xxxxxx";
38 TESTCASE( strncat( s, abcde, 10 ) == s );
39 TESTCASE( s[2] == 'a' );
40 TESTCASE( s[6] == 'e' );
41 TESTCASE( s[7] == '\0' );
42 TESTCASE( s[8] == 'x' );
44 TESTCASE( strncat( s, abcdx, 10 ) == s );
45 TESTCASE( s[4] == 'x' );
46 TESTCASE( s[5] == '\0' );
47 TESTCASE( strncat( s, "\0", 10 ) == s );
48 TESTCASE( s[5] == '\0' );
49 TESTCASE( s[6] == 'e' );
50 TESTCASE( strncat( s, abcde, 0 ) == s );
51 TESTCASE( s[5] == '\0' );
52 TESTCASE( s[6] == 'e' );
53 TESTCASE( strncat( s, abcde, 3 ) == s );
54 TESTCASE( s[5] == 'a' );
55 TESTCASE( s[7] == 'c' );
56 TESTCASE( s[8] == '\0' );