X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrnlen.c;h=a4b5a9eadf134301a286bf4652b1e1537e5b5164;hb=8894c921674bb116d0a7b8f23a55311e7a768019;hp=e7eab5712bfbd6b13e335c9750956367c2061549;hpb=70713966ce3d6ef8965458e804fc47e2640ab51f;p=pdclib diff --git a/functions/string/strnlen.c b/functions/string/strnlen.c index e7eab57..a4b5a9e 100644 --- a/functions/string/strnlen.c +++ b/functions/string/strnlen.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* strnlen( const char *, size_t len ) This file is part of the Public Domain C Library (PDCLib). @@ -16,7 +14,7 @@ size_t strnlen( const char * s, size_t maxlen ) for( size_t len = 0; len != maxlen; len++ ) { if(s[len] == '\0') - return len - 1; + return len; } return maxlen; } @@ -24,7 +22,7 @@ size_t strnlen( const char * s, size_t maxlen ) #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" int main( void ) {