X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fwchar%2Fwcscat.c;h=c467af0ef04819bc7c556396e449e82f82abe10f;hp=22a04c57935d567773b2ef10de7a79dfdc5c6fd0;hb=abc15df6b9fae3374d24c7cf5c3ab94c605b2a6d;hpb=8894c921674bb116d0a7b8f23a55311e7a768019 diff --git a/functions/wchar/wcscat.c b/functions/wchar/wcscat.c index 22a04c5..c467af0 100644 --- a/functions/wchar/wcscat.c +++ b/functions/wchar/wcscat.c @@ -1,45 +1,45 @@ -/* wcscat( wchar_t *, const wchar_t * ) - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -#include - -#ifndef REGTEST - -wchar_t * wcscat( wchar_t * _PDCLIB_restrict s1, - const wchar_t * _PDCLIB_restrict s2 ) -{ - wchar_t * rc = s1; - if ( *s1 ) - { - while ( *++s1 ); - } - while ( (*s1++ = *s2++) ); - return rc; -} - -#endif - -#ifdef TEST -#include "_PDCLIB_test.h" - -int main( void ) -{ - wchar_t s[] = L"xx\0xxxxxx"; - TESTCASE( wcscat( s, wabcde ) == s ); - TESTCASE( s[2] == L'a' ); - TESTCASE( s[6] == L'e' ); - TESTCASE( s[7] == L'\0' ); - TESTCASE( s[8] == L'x' ); - s[0] = L'\0'; - TESTCASE( wcscat( s, wabcdx ) == s ); - TESTCASE( s[4] == L'x' ); - TESTCASE( s[5] == L'\0' ); - TESTCASE( wcscat( s, L"\0" ) == s ); - TESTCASE( s[5] == L'\0' ); - TESTCASE( s[6] == L'e' ); - return TEST_RESULTS; -} -#endif +/* wcscat( wchar_t *, const wchar_t * ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +#ifndef REGTEST + +wchar_t * wcscat( wchar_t * _PDCLIB_restrict s1, + const wchar_t * _PDCLIB_restrict s2 ) +{ + wchar_t * rc = s1; + if ( *s1 ) + { + while ( *++s1 ); + } + while ( (*s1++ = *s2++) ); + return rc; +} + +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +int main( void ) +{ + wchar_t s[] = L"xx\0xxxxxx"; + TESTCASE( wcscat( s, wabcde ) == s ); + TESTCASE( s[2] == L'a' ); + TESTCASE( s[6] == L'e' ); + TESTCASE( s[7] == L'\0' ); + TESTCASE( s[8] == L'x' ); + s[0] = L'\0'; + TESTCASE( wcscat( s, wabcdx ) == s ); + TESTCASE( s[4] == L'x' ); + TESTCASE( s[5] == L'\0' ); + TESTCASE( wcscat( s, L"\0" ) == s ); + TESTCASE( s[5] == L'\0' ); + TESTCASE( s[6] == L'e' ); + return TEST_RESULTS; +} +#endif