diff options
Diffstat (limited to 'src/string/strchr.c')
-rw-r--r-- | src/string/strchr.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/string/strchr.c b/src/string/strchr.c new file mode 100644 index 00000000..874db9be --- /dev/null +++ b/src/string/strchr.c @@ -0,0 +1,22 @@ +#include <string.h> +#include "nonstd/assert.h" + +/** string search **/ +char * strchr(const char *s, int c) +{ + ASSERT_NONNULL(s); + + /* + RETURN_FAILURE(CONSTANT(NULL)); + RETURN_SUCCESS(a pointer to the located character); + */ + return (char*)memchr(s, (char)c, strlen(s)); +} + +/*** +searches the string ARGUMENT(s) for the first occurrence of +ARGUMENT(c) (converted to a TYPE(char)). +***/ +/* +STDC(1) +*/ |