Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / string / strchrnul.c
blobf5c3eb25dfc2673209da0512aa37d6d209d6703e
1 /*
2 FUNCTION
3 <<strchrnul>>---search for character in string
5 INDEX
6 strchrnul
8 SYNOPSIS
9 #include <string.h>
10 char * strchrnul(const char *<[string]>, int <[c]>);
12 DESCRIPTION
13 This function finds the first occurence of <[c]> (converted to
14 a char) in the string pointed to by <[string]> (including the
15 terminating null character).
17 RETURNS
18 Returns a pointer to the located character, or a pointer
19 to the concluding null byte if <[c]> does not occur in <[string]>.
21 PORTABILITY
22 <<strchrnul>> is a GNU extension.
24 <<strchrnul>> requires no supporting OS subroutines. It uses
25 strchr() and strlen() from elsewhere in this library.
27 QUICKREF
28 strchrnul
31 #include <string.h>
33 char *
34 strchrnul (const char *s1,
35 int i)
37 char *s = strchr(s1, i);
39 return s ? s : (char *)s1 + strlen(s1);