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