X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrchr.c;h=a575f6deea1b15e44b65ef94826a1f1ddc607b29;hb=c0169638bd02098717cb23fbbca3bcc4e4caccf0;hp=bff8d054e20ae212c8d5e96064e1b8bbe2a5729d;hpb=714f97432fcfa2122e21fd3cf184d49a213a180c;p=pdclib diff --git a/functions/string/strchr.c b/functions/string/strchr.c index bff8d05..a575f6d 100644 --- a/functions/string/strchr.c +++ b/functions/string/strchr.c @@ -1,21 +1,25 @@ -// ---------------------------------------------------------------------------- -// $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.