X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrspn.c;h=d58ec9e46c996cf0d709d3207a00a4d2b2bfcce8;hb=f5a3525453c158f6b6091587075b527bd569853d;hp=55cf29a084aa87f8ae2e5b2f8522b99e2f8a70d7;hpb=c8f799d852e3698468a78954d82588e841cc0b70;p=pdclib.old diff --git a/functions/string/strspn.c b/functions/string/strspn.c index 55cf29a..d58ec9e 100644 --- a/functions/string/strspn.c +++ b/functions/string/strspn.c @@ -1,28 +1,31 @@ -/* ---------------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------------- - * Public Domain C Library - http://pdclib.sourceforge.net - * This code is Public Domain. Use, modify, and redistribute at will. - * --------------------------------------------------------------------------*/ +/* $Id$ */ -#include <__size_t.h> +/* Release $Name$ */ -size_t strspn( const char * src_1, const char * src_2 ) +/* strspn( const char *, const char * ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +size_t strspn( const char * s1, const char * s2 ) { size_t len = 0; const char * p; - while ( src_1[ len ] != '\0' ) + while ( s1[ len ] ) { - p = src_2; - while ( *p != '\0' ) + p = s2; + while ( *p ) { - if ( *src_1 == *p ) + if ( s1[len] == *p ) { break; } ++p; } - if ( *p == '\0' ) + if ( ! *p ) { return len; }