summaryrefslogtreecommitdiff
path: root/src/string/strchr.c
blob: 5793743bfd655475b7c5590e92f14023b7e2aba5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <string.h>
#include "_safety.h"
#undef strchr

/** string search **/

char * strchr(const char *s, int c)
{
	SIGNAL_SAFE(0);
	ASSERT_NONNULL(s);

	/*
	RETURN_FAILURE(CONSTANT(NULL));
	RETURN_SUCCESS(a pointer to the located character);
	*/
	return (char*)memchr(s, (char)c, strlen(s));
}

__check_2(char *, 0, strchr, const char *, int)

/***
searches the string ARGUMENT(s) for the first occurrence of
ARGUMENT(c) (converted to a TYPE(char)).
***/

/*
STDC(1)
*/