]> pd.if.org Git - pdclib/blob - functions/string/strlen.c
4856d99502254f07569e494c7103ebe183709122
[pdclib] / functions / string / strlen.c
1 /* strlen( const char * )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <string.h>
8
9 #ifndef REGTEST
10
11 size_t strlen( const char * s )
12 {
13     size_t rc = 0;
14     while ( s[rc] )
15     {
16         ++rc;
17     }
18     return rc;
19 }
20
21 #endif
22
23 #ifdef TEST
24 #include <_PDCLIB_test.h>
25
26 int main( void )
27 {
28     TESTCASE( strlen( abcde ) == 5 );
29     TESTCASE( strlen( "" ) == 0 );
30     return TEST_RESULTS;
31 }
32 #endif