]> pd.if.org Git - pdclib/blobdiff - functions/string/strchr.c
Added dummy test drivers to each *.c file, and target 'test' to Makefile.
[pdclib] / functions / string / strchr.c
index dcfc025e8cd4bec4ed62e9c548710914b2ae7929..ec296cbce33cab48ae8b9aeaa6fed4500710c83b 100644 (file)
@@ -1,28 +1,32 @@
-// ----------------------------------------------------------------------------
-// $Id$
-// ----------------------------------------------------------------------------
-// Public Domain C Library - http://pdclib.sourceforge.net
-// This code is Public Domain. Use, modify, and redistribute at will.
-// ----------------------------------------------------------------------------
+/* $Id$ */
 
-// ----------------------------------------------------------------------------
-// C++
+/* Release $Name$ */
 
-const char * strchr( const char * s, int c ) { /* TODO */ };
-char * strchr( char * s, int c ) { /* TODO */ };
+/* strchr( const char *, int )
 
-// ----------------------------------------------------------------------------
-// Standard C
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
 
-char * strchr( const char * s, int c ) { /* TODO */ };
+#include <string.h>
 
-/* PDPC code - unreviewed
+char * strchr( const char * s, int c )
 {
-    while (*s != '\0')
+    do
     {
-        if (*s == (char)c) return ((char *)s);
-        s++;
-    }
-    return (NULL);
+        if ( *s == (char) c )
+        {
+            return (char *) s;
+        }
+    } while ( *s++ );
+    return NULL;
 }
-*/
+
+#warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif