X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrchr.c;h=ec296cbce33cab48ae8b9aeaa6fed4500710c83b;hb=ba5eff8dd9b426485e1559b5d6204692d155d9e8;hp=960e7e4ed599fd9070b13007969ea5485464831e;hpb=1d9d92ba957a0b8307c9a65c35867fde68e6533b;p=pdclib diff --git a/functions/string/strchr.c b/functions/string/strchr.c index 960e7e4..ec296cb 100644 --- a/functions/string/strchr.c +++ b/functions/string/strchr.c @@ -1,21 +1,32 @@ -/* ---------------------------------------------------------------------------- - * $Id$ - * ---------------------------------------------------------------------------- - * Public Domain C Library - http://pdclib.sourceforge.net - * This code is Public Domain. Use, modify, and redistribute at will. - * --------------------------------------------------------------------------*/ +/* $Id$ */ -#include <__NULL.h> +/* Release $Name$ */ -char * strchr( const char * src, int c ) +/* strchr( const char *, int ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +char * strchr( const char * s, int c ) { - while ( *src != '\0' ) + do { - if ( *src == (const char) c ) + if ( *s == (char) c ) { - return (char *) src; + return (char *) s; } - ++src; - } + } while ( *s++ ); return NULL; } + +#warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif