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