From: solar Date: Sun, 18 Jan 2004 15:59:07 +0000 (+0000) Subject: Reviewed. X-Git-Tag: OLD~13 X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=714f97432fcfa2122e21fd3cf184d49a213a180c Reviewed. --- 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; } -*/