-/* wcsstr( const wchar_t *, const wchar_t * )\r
-\r
- This file is part of the Public Domain C Library (PDCLib).\r
- Permission is granted to use, modify, and / or redistribute at will.\r
-*/\r
-\r
-#include <wchar.h>\r
-\r
-#ifndef REGTEST\r
-\r
-wchar_t * wcsstr( const wchar_t * s1, const wchar_t * s2 )\r
-{\r
- const wchar_t * p1 = s1;\r
- const wchar_t * p2;\r
- while ( *s1 )\r
- {\r
- p2 = s2;\r
- while ( *p2 && ( *p1 == *p2 ) )\r
- {\r
- ++p1;\r
- ++p2;\r
- }\r
- if ( ! *p2 )\r
- {\r
- return (wchar_t *) s1;\r
- }\r
- ++s1;\r
- p1 = s1;\r
- }\r
- return NULL;\r
-}\r
-\r
-#endif\r
-\r
-#ifdef TEST\r
-#include <_PDCLIB_test.h>\r
-\r
-int main( void )\r
-{\r
- wchar_t s[] = L"abcabcabcdabcde";\r
- TESTCASE( wcsstr( s, L"x" ) == NULL );\r
- TESTCASE( wcsstr( s, L"xyz" ) == NULL );\r
- TESTCASE( wcsstr( s, L"a" ) == &s[0] );\r
- TESTCASE( wcsstr( s, L"abc" ) == &s[0] );\r
- TESTCASE( wcsstr( s, L"abcd" ) == &s[6] );\r
- TESTCASE( wcsstr( s, L"abcde" ) == &s[10] );\r
- return TEST_RESULTS;\r
-}\r
-#endif\r
+/* wcsstr( const 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 <wchar.h>
+
+#ifndef REGTEST
+
+wchar_t * wcsstr( const wchar_t * s1, const wchar_t * s2 )
+{
+ const wchar_t * p1 = s1;
+ const wchar_t * p2;
+ while ( *s1 )
+ {
+ p2 = s2;
+ while ( *p2 && ( *p1 == *p2 ) )
+ {
+ ++p1;
+ ++p2;
+ }
+ if ( ! *p2 )
+ {
+ return (wchar_t *) s1;
+ }
+ ++s1;
+ p1 = s1;
+ }
+ return NULL;
+}
+
+#endif
+
+#ifdef TEST
+#include "_PDCLIB_test.h"
+
+int main( void )
+{
+ wchar_t s[] = L"abcabcabcdabcde";
+ TESTCASE( wcsstr( s, L"x" ) == NULL );
+ TESTCASE( wcsstr( s, L"xyz" ) == NULL );
+ TESTCASE( wcsstr( s, L"a" ) == &s[0] );
+ TESTCASE( wcsstr( s, L"abc" ) == &s[0] );
+ TESTCASE( wcsstr( s, L"abcd" ) == &s[6] );
+ TESTCASE( wcsstr( s, L"abcde" ) == &s[10] );
+ return TEST_RESULTS;
+}
+#endif