From: solar Date: Sun, 18 Jan 2004 15:59:07 +0000 (+0000) Subject: Reviewed. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=11dc6d3d7d9413b7d9e365b3b26245261a974572;p=fw%2Fpdclib Reviewed. git-svn-id: https://srv7.svn-repos.de/dev34/pdclib/trunk@23 546481bc-9713-0410-bf18-d3337bbf4a3e --- diff --git a/functions/string/strchr.c b/functions/string/strchr.c index dcfc025..bff8d05 100644 --- a/functions/string/strchr.c +++ b/functions/string/strchr.c @@ -5,24 +5,17 @@ // This code is Public Domain. Use, modify, and redistribute at will. // ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- -// C++ - -const char * strchr( const char * s, int c ) { /* TODO */ }; -char * strchr( char * s, int c ) { /* TODO */ }; - -// ---------------------------------------------------------------------------- -// Standard C - -char * strchr( const char * s, int c ) { /* TODO */ }; +#include <__NULL.h> -/* PDPC code - unreviewed +char * strchr( const char * src, int c ) { - while (*s != '\0') + while ( *src != '\0' ) { - if (*s == (char)c) return ((char *)s); - s++; + if ( *src == (const char) c ) + { + return (char *) src; + } + ++src; } - return (NULL); + return NULL; } -*/